Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/tensorflow/python/__init__.py: 14%

50 statements  

« prev     ^ index     » next       coverage.py v7.3.2, created at 2023-10-05 06:32 +0000

1# Copyright 2015 The TensorFlow Authors. All Rights Reserved. 

2# 

3# Licensed under the Apache License, Version 2.0 (the "License"); 

4# you may not use this file except in compliance with the License. 

5# You may obtain a copy of the License at 

6# 

7# http://www.apache.org/licenses/LICENSE-2.0 

8# 

9# Unless required by applicable law or agreed to in writing, software 

10# distributed under the License is distributed on an "AS IS" BASIS, 

11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 

12# See the License for the specific language governing permissions and 

13# limitations under the License. 

14# ============================================================================== 

15"""Import core names of TensorFlow. 

16 

17Programs that want to build TensorFlow Ops and Graphs without having to import 

18the constructors and utilities individually can import this file: 

19 

20 

21import tensorflow as tf 

22""" 

23 

24import ctypes 

25import importlib 

26import sys 

27import traceback 

28 

29# We aim to keep this file minimal and ideally remove completely. 

30# If you are adding a new file with @tf_export decorators, 

31# import it in modules_with_exports.py instead. 

32 

33# go/tf-wildcard-import 

34# pylint: disable=wildcard-import,g-bad-import-order,g-import-not-at-top 

35 

36from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow 

37from tensorflow.python.eager import context 

38 

39# pylint: enable=wildcard-import 

40 

41# from tensorflow.python import keras 

42from tensorflow.python.feature_column import feature_column_lib as feature_column 

43# from tensorflow.python.layers import layers 

44from tensorflow.python.module import module 

45from tensorflow.python.profiler import profiler 

46from tensorflow.python.profiler import profiler_client 

47from tensorflow.python.profiler import profiler_v2 

48from tensorflow.python.profiler import trace 

49from tensorflow.python.saved_model import saved_model 

50from tensorflow.python.summary import summary 

51from tensorflow.python.tpu import api 

52from tensorflow.python.user_ops import user_ops 

53from tensorflow.python.util import compat 

54 

55# Import the names from python/training.py as train.Name. 

56from tensorflow.python.training import training as train 

57from tensorflow.python.training import quantize_training as _quantize_training 

58 

59# Sub-package for performing i/o directly instead of via ops in a graph. 

60from tensorflow.python.lib.io import python_io 

61 

62# Make some application and test modules available. 

63from tensorflow.python.platform import app 

64from tensorflow.python.platform import flags 

65from tensorflow.python.platform import gfile 

66from tensorflow.python.platform import tf_logging as logging 

67from tensorflow.python.platform import resource_loader 

68from tensorflow.python.platform import sysconfig as sysconfig_lib 

69from tensorflow.python.platform import test 

70 

71from tensorflow.python.compat import v2_compat 

72 

73from tensorflow.python.util.all_util import make_all 

74from tensorflow.python.util.tf_export import tf_export 

75 

76# Eager execution 

77from tensorflow.python.eager.context import executing_eagerly 

78from tensorflow.python.eager.remote import connect_to_remote_host 

79from tensorflow.python.eager.def_function import function 

80 

81# Check whether TF2_BEHAVIOR is turned on. 

82from tensorflow.python.eager import monitoring as _monitoring 

83from tensorflow.python import tf2 as _tf2 

84_tf2_gauge = _monitoring.BoolGauge( 

85 '/tensorflow/api/tf2_enable', 'Environment variable TF2_BEHAVIOR is set".') 

86_tf2_gauge.get_cell().set(_tf2.enabled()) 

87 

88# TensorFlow Debugger (tfdbg). 

89from tensorflow.python.debug.lib import check_numerics_callback 

90from tensorflow.python.debug.lib import dumping_callback 

91from tensorflow.python.ops import gen_debug_ops 

92 

93# DLPack 

94from tensorflow.python.dlpack.dlpack import from_dlpack 

95from tensorflow.python.dlpack.dlpack import to_dlpack 

96 

97# XLA JIT compiler APIs. 

98from tensorflow.python.compiler.xla import jit 

99from tensorflow.python.compiler.xla import xla 

100 

101# MLIR APIs. 

102from tensorflow.python.compiler.mlir import mlir 

103 

104# Update dispatch decorator docstrings to contain lists of registered APIs. 

105# (This should come after any imports that register APIs.) 

106from tensorflow.python.util import dispatch 

107dispatch.update_docstrings_with_api_lists() 

108 

109# Special dunders that we choose to export: 

110_exported_dunders = set([ 

111 '__version__', 

112 '__git_version__', 

113 '__compiler_version__', 

114 '__cxx11_abi_flag__', 

115 '__monolithic_build__', 

116]) 

117 

118# Expose symbols minus dunders, unless they are allowlisted above. 

119# This is necessary to export our dunders. 

120__all__ = [s for s in dir() if s in _exported_dunders or not s.startswith('_')]