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 17 """Import names of Tensor Flow standard Ops.""" 18 19 from __future__ import absolute_import 20 from __future__ import division 21 from __future__ import print_function 22 23 import sys as _sys 24 25 # Imports the following modules so that @RegisterGradient get executed. 26 from tensorflow.python.ops import array_grad 27 from tensorflow.python.ops import data_flow_grad 28 from tensorflow.python.ops import manip_grad 29 from tensorflow.python.ops import math_grad 30 from tensorflow.python.ops import manip_grad 31 from tensorflow.python.ops import sparse_grad 32 from tensorflow.python.ops import spectral_grad 33 from tensorflow.python.ops import state_grad 34 from tensorflow.python.ops import tensor_array_grad 35 from tensorflow.python.util.all_util import remove_undocumented 36 37 38 # go/tf-wildcard-import 39 # pylint: disable=wildcard-import 40 from tensorflow.python.ops.array_ops import * 41 from tensorflow.python.ops.check_ops import * 42 from tensorflow.python.ops.clip_ops import * 43 from tensorflow.python.ops.special_math_ops import * 44 # TODO(vrv): Switch to import * once we're okay with exposing the module. 45 from tensorflow.python.ops.confusion_matrix import confusion_matrix 46 from tensorflow.python.ops.control_flow_ops import Assert 47 from tensorflow.python.ops.control_flow_ops import case 48 from tensorflow.python.ops.control_flow_ops import cond 49 from tensorflow.python.ops.control_flow_ops import group 50 from tensorflow.python.ops.control_flow_ops import no_op 51 from tensorflow.python.ops.control_flow_ops import tuple # pylint: disable=redefined-builtin 52 # pylint: enable=redefined-builtin 53 from tensorflow.python.ops.control_flow_ops import while_loop 54 from tensorflow.python.ops.data_flow_ops import * 55 from tensorflow.python.ops.functional_ops import * 56 from tensorflow.python.ops.gradients import * 57 from tensorflow.python.ops.histogram_ops import * 58 from tensorflow.python.ops.init_ops import * 59 from tensorflow.python.ops.io_ops import * 60 from tensorflow.python.ops.linalg_ops import * 61 from tensorflow.python.ops.logging_ops import Print 62 from tensorflow.python.ops.logging_ops import get_summary_op 63 from tensorflow.python.ops.lookup_ops import initialize_all_tables 64 from tensorflow.python.ops.lookup_ops import tables_initializer 65 from tensorflow.python.ops.manip_ops import * 66 from tensorflow.python.ops.math_ops import * 67 from tensorflow.python.ops.numerics import * 68 from tensorflow.python.ops.parsing_ops import * 69 from tensorflow.python.ops.partitioned_variables import * 70 from tensorflow.python.ops.random_ops import * 71 from tensorflow.python.ops.script_ops import py_func 72 from tensorflow.python.ops.session_ops import * 73 from tensorflow.python.ops.sparse_ops import * 74 from tensorflow.python.ops.state_ops import assign 75 from tensorflow.python.ops.state_ops import assign_add 76 from tensorflow.python.ops.state_ops import assign_sub 77 from tensorflow.python.ops.state_ops import count_up_to 78 from tensorflow.python.ops.state_ops import scatter_add 79 from tensorflow.python.ops.state_ops import scatter_div 80 from tensorflow.python.ops.state_ops import scatter_mul 81 from tensorflow.python.ops.state_ops import scatter_sub 82 from tensorflow.python.ops.state_ops import scatter_update 83 from tensorflow.python.ops.state_ops import scatter_nd_add 84 from tensorflow.python.ops.state_ops import scatter_nd_sub 85 # TODO(simister): Re-enable once binary size increase due to scatter_nd 86 # ops is under control. 87 # from tensorflow.python.ops.state_ops import scatter_nd_mul 88 # from tensorflow.python.ops.state_ops import scatter_nd_div 89 from tensorflow.python.ops.state_ops import scatter_nd_update 90 from tensorflow.python.ops.string_ops import * 91 from tensorflow.python.ops.template import * 92 from tensorflow.python.ops.tensor_array_ops import * 93 from tensorflow.python.ops.variable_scope import * 94 from tensorflow.python.ops.variables import * 95 # pylint: enable=wildcard-import 96 97 #### For use in remove_undocumented below: 98 from tensorflow.python.framework import constant_op as _constant_op 99 from tensorflow.python.ops import array_ops as _array_ops 100 from tensorflow.python.ops import check_ops as _check_ops 101 from tensorflow.python.ops import clip_ops as _clip_ops 102 from tensorflow.python.ops import confusion_matrix as _confusion_matrix 103 from tensorflow.python.ops import control_flow_ops as _control_flow_ops 104 from tensorflow.python.ops import data_flow_ops as _data_flow_ops 105 from tensorflow.python.ops import functional_ops as _functional_ops 106 from tensorflow.python.ops import gradients as _gradients 107 from tensorflow.python.ops import histogram_ops as _histogram_ops 108 from tensorflow.python.ops import init_ops as _init_ops 109 from tensorflow.python.ops import io_ops as _io_ops 110 from tensorflow.python.ops import linalg_ops as _linalg_ops 111 from tensorflow.python.ops import logging_ops as _logging_ops 112 from tensorflow.python.ops import manip_ops as _manip_ops 113 from tensorflow.python.ops import math_ops as _math_ops 114 from tensorflow.python.ops import numerics as _numerics 115 from tensorflow.python.ops import parsing_ops as _parsing_ops 116 from tensorflow.python.ops import partitioned_variables as _partitioned_variables 117 from tensorflow.python.ops import random_ops as _random_ops 118 from tensorflow.python.ops import script_ops as _script_ops 119 from tensorflow.python.ops import session_ops as _session_ops 120 from tensorflow.python.ops import sparse_ops as _sparse_ops 121 from tensorflow.python.ops import special_math_ops as _special_math_ops 122 from tensorflow.python.ops import state_ops as _state_ops 123 from tensorflow.python.ops import string_ops as _string_ops 124 from tensorflow.python.ops import template as _template 125 from tensorflow.python.ops import tensor_array_ops as _tensor_array_ops 126 from tensorflow.python.ops import variable_scope as _variable_scope 127 from tensorflow.python.ops import variables as _variables 128 129 130 _allowed_symbols_math_ops = [ 131 # TODO(drpng): decide if we want to reference these in the documentation. 132 "reduced_shape", 133 "sparse_segment_mean_grad", 134 "sparse_segment_sqrt_n_grad", 135 136 # Legacy: will be removed. 137 "arg_max", 138 "arg_min", 139 "lin_space", 140 "sparse_matmul", # Use tf.matmul. 141 # Deprecated (see versions.h): 142 "batch_fft", 143 "batch_fft2d", 144 "batch_fft3d", 145 "batch_ifft", 146 "batch_ifft2d", 147 "batch_ifft3d", 148 "mul", # use tf.multiply instead. 149 "neg", # use tf.negative instead. 150 "sub", # use tf.subtract instead. 151 152 # These are documented in nn. 153 # We are not importing nn because it would create a circular dependency. 154 "sigmoid", 155 "log_sigmoid", 156 "tanh", 157 ] 158 159 _allowed_symbols_array_ops = [ 160 # TODO(drpng): make sure they are documented. 161 # Scalars: 162 "NEW_AXIS", 163 "SHRINK_AXIS", 164 "newaxis", 165 166 # Documented in training.py. 167 # I do not import train, to avoid circular dependencies. 168 # TODO(drpng): this is defined in gen_array_ops, clearly not the right 169 # place. 170 "stop_gradient", 171 172 # See gen_docs_combined for tf.copy documentation. 173 "copy", 174 175 ## TODO(drpng): make them inaccessible directly. 176 ## TODO(drpng): Below, to-doc means that we need to find an appropriate 177 ## documentation section to reference. 178 ## For re-exporting to tf.*: 179 "constant", 180 "edit_distance", # to-doc 181 # From gen_array_ops: 182 "copy_host", # to-doc 183 "immutable_const", # to-doc 184 "invert_permutation", # to-doc 185 "quantize_and_dequantize", # to-doc 186 187 # TODO(drpng): legacy symbols to be removed. 188 "list_diff", # Use tf.listdiff instead. 189 "batch_matrix_diag", 190 "batch_matrix_band_part", 191 "batch_matrix_diag_part", 192 "batch_matrix_set_diag", 193 ] 194 195 _allowed_symbols_partitioned_variables = [ 196 "PartitionedVariable", # Requires doc link. 197 # Legacy. 198 "create_partitioned_variables", 199 "variable_axis_size_partitioner", 200 "min_max_variable_partitioner", 201 "fixed_size_partitioner", 202 ] 203 204 _allowed_symbols_control_flow_ops = [ 205 # TODO(drpng): Find a place in the documentation to reference these or 206 # remove. 207 "control_trigger", 208 "loop_cond", 209 "merge", 210 "switch", 211 ] 212 213 _allowed_symbols_functional_ops = [ 214 "nest", # Used by legacy code. 215 ] 216 217 _allowed_symbols_gradients = [ 218 # Documented in training.py: 219 # Not importing training.py to avoid complex graph dependencies. 220 "AggregationMethod", 221 "gradients", # tf.gradients = gradients.gradients 222 "hessians", 223 ] 224 225 _allowed_symbols_clip_ops = [ 226 # Documented in training.py: 227 # Not importing training.py to avoid complex graph dependencies. 228 "clip_by_average_norm", 229 "clip_by_global_norm", 230 "clip_by_norm", 231 "clip_by_value", 232 "global_norm", 233 ] 234 235 _allowed_symbols_image_ops = [ 236 # Documented in training.py. 237 # We are not importing training.py to avoid complex dependencies. 238 "audio_summary", 239 "histogram_summary", 240 "image_summary", 241 "merge_all_summaries", 242 "merge_summary", 243 "scalar_summary", 244 245 # TODO(drpng): link in training.py if it should be documented. 246 "get_summary_op", 247 ] 248 249 _allowed_symbols_variable_scope_ops = [ 250 "get_local_variable", # Documented in framework package. 251 ] 252 253 _allowed_symbols_misc = [ 254 "deserialize_many_sparse", 255 "parse_single_sequence_example", 256 "serialize_many_sparse", 257 "serialize_sparse", 258 "confusion_matrix", 259 ] 260 261 _allowed_symbols = (_allowed_symbols_array_ops + 262 _allowed_symbols_clip_ops + 263 _allowed_symbols_control_flow_ops + 264 _allowed_symbols_functional_ops + 265 _allowed_symbols_image_ops + 266 _allowed_symbols_gradients + 267 _allowed_symbols_math_ops + 268 _allowed_symbols_variable_scope_ops + 269 _allowed_symbols_misc + 270 _allowed_symbols_partitioned_variables) 271 272 remove_undocumented(__name__, _allowed_symbols, [ 273 _sys.modules[__name__], 274 _array_ops, 275 _check_ops, 276 _clip_ops, 277 _confusion_matrix, 278 _control_flow_ops, 279 _constant_op, 280 _data_flow_ops, 281 _functional_ops, 282 _gradients, 283 _histogram_ops, 284 _init_ops, 285 _io_ops, 286 _linalg_ops, 287 _logging_ops, 288 _manip_ops, 289 _math_ops, 290 _numerics, 291 _parsing_ops, 292 _partitioned_variables, 293 _random_ops, 294 _script_ops, 295 _session_ops, 296 _sparse_ops, 297 _special_math_ops, 298 _state_ops, 299 _string_ops, 300 _template, 301 _tensor_array_ops, 302 _variable_scope, 303 _variables, 304 ]) 305