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 16 # pylint: disable=unused-import,g-bad-import-order 17 """Classes and functions for building TensorFlow graphs. 18 19 ## Core graph data structures 20 21 @@Graph 22 @@Operation 23 @@Tensor 24 25 ## Tensor types 26 27 @@DType 28 @@as_dtype 29 30 ## Utility functions 31 32 @@device 33 @@container 34 @@name_scope 35 @@colocate_with 36 @@control_dependencies 37 @@convert_to_tensor 38 @@convert_to_tensor_or_indexed_slices 39 @@convert_to_tensor_or_sparse_tensor 40 @@get_default_graph 41 @@reset_default_graph 42 @@import_graph_def 43 @@load_file_system_library 44 @@load_op_library 45 @@make_tensor_proto 46 @@make_ndarray 47 48 ## Graph collections 49 50 @@add_to_collection 51 @@get_collection 52 @@get_collection_ref 53 @@GraphKeys 54 55 ## Defining new operations 56 57 @@RegisterGradient 58 @@NotDifferentiable 59 @@NoGradient 60 @@TensorShape 61 @@Dimension 62 @@op_scope 63 @@get_seed 64 65 ## For libraries building on TensorFlow 66 67 @@register_tensor_conversion_function 68 """ 69 70 from __future__ import absolute_import 71 from __future__ import division 72 from __future__ import print_function 73 74 # Classes used when building a Graph. 75 from tensorflow.python.framework.device import DeviceSpec 76 from tensorflow.python.framework.ops import Graph 77 from tensorflow.python.framework.ops import Operation 78 from tensorflow.python.framework.ops import Tensor 79 from tensorflow.python.framework.ops import IndexedSlices 80 81 from tensorflow.python.framework.sparse_tensor import SparseTensor 82 from tensorflow.python.framework.sparse_tensor import SparseTensorValue 83 84 # Utilities used when building a Graph. 85 from tensorflow.python.framework.ops import device 86 from tensorflow.python.framework.ops import container 87 from tensorflow.python.framework.ops import name_scope 88 from tensorflow.python.framework.ops import op_scope 89 from tensorflow.python.framework.ops import colocate_with 90 from tensorflow.python.framework.ops import control_dependencies 91 from tensorflow.python.framework.ops import get_default_graph 92 from tensorflow.python.framework.ops import reset_default_graph 93 from tensorflow.python.framework.ops import GraphKeys 94 from tensorflow.python.framework.ops import add_to_collection 95 from tensorflow.python.framework.ops import get_collection 96 from tensorflow.python.framework.ops import get_collection_ref 97 from tensorflow.python.framework.ops import convert_to_tensor 98 from tensorflow.python.framework.ops import convert_to_tensor_or_indexed_slices 99 from tensorflow.python.framework.random_seed import get_seed 100 from tensorflow.python.framework.random_seed import set_random_seed 101 from tensorflow.python.framework.sparse_tensor import convert_to_tensor_or_sparse_tensor 102 from tensorflow.python.framework.importer import import_graph_def 103 104 # Utilities for working with Tensors 105 from tensorflow.python.framework.tensor_util import make_tensor_proto 106 from tensorflow.python.framework.tensor_util import MakeNdarray as make_ndarray 107 108 # Needed when you defined a new Op in C++. 109 from tensorflow.python.framework.ops import RegisterGradient 110 from tensorflow.python.framework.ops import NotDifferentiable 111 from tensorflow.python.framework.ops import NoGradient 112 from tensorflow.python.framework.ops import RegisterShape 113 from tensorflow.python.framework.tensor_shape import Dimension 114 from tensorflow.python.framework.tensor_shape import TensorShape 115 116 # Needed when interfacing tensorflow to new array libraries 117 from tensorflow.python.framework.ops import register_tensor_conversion_function 118 119 # go/tf-wildcard-import 120 # pylint: disable=wildcard-import 121 from tensorflow.python.framework.dtypes import * # pylint: disable=redefined-builtin 122 123 # Load a TensorFlow plugin 124 from tensorflow.python.framework.load_library import * 125 # pylint: enable=wildcard-import 126