aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/python/ops/standard_ops.py
blob: 009d1dc3b93093271402d864b331233ae24f7c23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================

# pylint: disable=unused-import
"""Import names of Tensor Flow standard Ops."""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import sys as _sys

# Imports the following modules so that @RegisterGradient get executed.
from tensorflow.python.ops import array_grad
from tensorflow.python.ops import data_flow_grad
from tensorflow.python.ops import manip_grad
from tensorflow.python.ops import math_grad
from tensorflow.python.ops import sparse_grad
from tensorflow.python.ops import spectral_grad
from tensorflow.python.ops import state_grad
from tensorflow.python.ops import tensor_array_grad
from tensorflow.python.util.all_util import remove_undocumented


# go/tf-wildcard-import
# pylint: disable=wildcard-import
from tensorflow.python.ops.array_ops import *
from tensorflow.python.ops.check_ops import *
from tensorflow.python.ops.clip_ops import *
from tensorflow.python.ops.special_math_ops import *
# TODO(vrv): Switch to import * once we're okay with exposing the module.
from tensorflow.python.ops.confusion_matrix import confusion_matrix
from tensorflow.python.ops.control_flow_ops import Assert
from tensorflow.python.ops.control_flow_ops import case
from tensorflow.python.ops.control_flow_ops import cond
from tensorflow.python.ops.control_flow_ops import group
from tensorflow.python.ops.control_flow_ops import no_op
# pylint: disable=redefined-builtin
from tensorflow.python.ops.control_flow_ops import tuple
# pylint: enable=redefined-builtin
from tensorflow.python.ops.control_flow_ops import while_loop
from tensorflow.python.ops.data_flow_ops import *
from tensorflow.python.ops.functional_ops import *
from tensorflow.python.ops.gradients import *
from tensorflow.python.ops.histogram_ops import *
from tensorflow.python.ops.init_ops import *
from tensorflow.python.ops.io_ops import *
from tensorflow.python.ops.linalg_ops import *
from tensorflow.python.ops.logging_ops import Print
from tensorflow.python.ops.logging_ops import get_summary_op
from tensorflow.python.ops.lookup_ops import initialize_all_tables
from tensorflow.python.ops.lookup_ops import tables_initializer
from tensorflow.python.ops.manip_ops import *
from tensorflow.python.ops.math_ops import *
from tensorflow.python.ops.numerics import *
from tensorflow.python.ops.parsing_ops import *
from tensorflow.python.ops.partitioned_variables import *
from tensorflow.python.ops.random_ops import *
from tensorflow.python.ops.script_ops import py_func
from tensorflow.python.ops.session_ops import *
from tensorflow.python.ops.sparse_ops import *
from tensorflow.python.ops.state_ops import assign
from tensorflow.python.ops.state_ops import assign_add
from tensorflow.python.ops.state_ops import assign_sub
from tensorflow.python.ops.state_ops import count_up_to
from tensorflow.python.ops.state_ops import scatter_add
from tensorflow.python.ops.state_ops import scatter_div
from tensorflow.python.ops.state_ops import scatter_mul
from tensorflow.python.ops.state_ops import scatter_sub
from tensorflow.python.ops.state_ops import scatter_update
from tensorflow.python.ops.state_ops import scatter_nd_add
from tensorflow.python.ops.state_ops import scatter_nd_sub
# TODO(simister): Re-enable once binary size increase due to scatter_nd
# ops is under control.
# from tensorflow.python.ops.state_ops import scatter_nd_mul
# from tensorflow.python.ops.state_ops import scatter_nd_div
from tensorflow.python.ops.state_ops import scatter_nd_update
from tensorflow.python.ops.string_ops import *
from tensorflow.python.ops.template import *
from tensorflow.python.ops.tensor_array_ops import *
from tensorflow.python.ops.variable_scope import *
from tensorflow.python.ops.variables import *
# pylint: enable=wildcard-import

#### For use in remove_undocumented below:
from tensorflow.python.framework import constant_op as _constant_op
from tensorflow.python.ops import array_ops as _array_ops
from tensorflow.python.ops import check_ops as _check_ops
from tensorflow.python.ops import clip_ops as _clip_ops
from tensorflow.python.ops import confusion_matrix as _confusion_matrix
from tensorflow.python.ops import control_flow_ops as _control_flow_ops
from tensorflow.python.ops import data_flow_ops as _data_flow_ops
from tensorflow.python.ops import functional_ops as _functional_ops
from tensorflow.python.ops import gradients as _gradients
from tensorflow.python.ops import histogram_ops as _histogram_ops
from tensorflow.python.ops import init_ops as _init_ops
from tensorflow.python.ops import io_ops as _io_ops
from tensorflow.python.ops import linalg_ops as _linalg_ops
from tensorflow.python.ops import logging_ops as _logging_ops
from tensorflow.python.ops import manip_ops as _manip_ops
from tensorflow.python.ops import math_ops as _math_ops
from tensorflow.python.ops import numerics as _numerics
from tensorflow.python.ops import parsing_ops as _parsing_ops
from tensorflow.python.ops import partitioned_variables as _partitioned_variables
from tensorflow.python.ops import random_ops as _random_ops
from tensorflow.python.ops import script_ops as _script_ops
from tensorflow.python.ops import session_ops as _session_ops
from tensorflow.python.ops import sparse_ops as _sparse_ops
from tensorflow.python.ops import special_math_ops as _special_math_ops
from tensorflow.python.ops import state_ops as _state_ops
from tensorflow.python.ops import string_ops as _string_ops
from tensorflow.python.ops import template as _template
from tensorflow.python.ops import tensor_array_ops as _tensor_array_ops
from tensorflow.python.ops import variable_scope as _variable_scope
from tensorflow.python.ops import variables as _variables


_allowed_symbols_math_ops = [
    # TODO(drpng): decide if we want to reference these in the documentation.
    "reduced_shape",
    "sparse_segment_mean_grad",
    "sparse_segment_sqrt_n_grad",

    # Legacy: will be removed.
    "arg_max",
    "arg_min",
    "lin_space",
    "sparse_matmul",  # Use tf.matmul.
    # Deprecated (see versions.h):
    "batch_fft",
    "batch_fft2d",
    "batch_fft3d",
    "batch_ifft",
    "batch_ifft2d",
    "batch_ifft3d",
    "mul",  # use tf.multiply instead.
    "neg",  # use tf.negative instead.
    "sub",  # use tf.subtract instead.

    # These are documented in nn.
    # We are not importing nn because it would create a circular dependency.
    "sigmoid",
    "log_sigmoid",
    "tanh",
]

_allowed_symbols_array_ops = [
    # TODO(drpng): make sure they are documented.
    # Scalars:
    "NEW_AXIS",
    "SHRINK_AXIS",
    "newaxis",

    # Documented in training.py.
    # I do not import train, to avoid circular dependencies.
    # TODO(drpng): this is defined in gen_array_ops, clearly not the right
    # place.
    "stop_gradient",

    # See gen_docs_combined for tf.copy documentation.
    "copy",

    ## TODO(drpng): make them inaccessible directly.
    ## TODO(drpng): Below, to-doc means that we need to find an appropriate
    ##  documentation section to reference.
    ## For re-exporting to tf.*:
    "constant",
    "edit_distance",  # to-doc
    # From gen_array_ops:
    "copy_host",  # to-doc
    "immutable_const",  # to-doc
    "invert_permutation",  # to-doc
    "quantize_and_dequantize",  # to-doc

    # TODO(drpng): legacy symbols to be removed.
    "list_diff",  # Use tf.listdiff instead.
    "batch_matrix_diag",
    "batch_matrix_band_part",
    "batch_matrix_diag_part",
    "batch_matrix_set_diag",
]

_allowed_symbols_partitioned_variables = [
    "PartitionedVariable",   # Requires doc link.
    # Legacy.
    "create_partitioned_variables",
    "variable_axis_size_partitioner",
    "min_max_variable_partitioner",
    "fixed_size_partitioner",
]

_allowed_symbols_control_flow_ops = [
    # TODO(drpng): Find a place in the documentation to reference these or
    # remove.
    "control_trigger",
    "loop_cond",
    "merge",
    "switch",
]

_allowed_symbols_functional_ops = [
    "nest",  # Used by legacy code.
]

_allowed_symbols_gradients = [
    # Documented in training.py:
    # Not importing training.py to avoid complex graph dependencies.
    "AggregationMethod",
    "gradients",  # tf.gradients = gradients.gradients
    "hessians",
]

_allowed_symbols_clip_ops = [
    # Documented in training.py:
    # Not importing training.py to avoid complex graph dependencies.
    "clip_by_average_norm",
    "clip_by_global_norm",
    "clip_by_norm",
    "clip_by_value",
    "global_norm",
]

_allowed_symbols_image_ops = [
    # Documented in training.py.
    # We are not importing training.py to avoid complex dependencies.
    "audio_summary",
    "histogram_summary",
    "image_summary",
    "merge_all_summaries",
    "merge_summary",
    "scalar_summary",

    # TODO(drpng): link in training.py if it should be documented.
    "get_summary_op",
]

_allowed_symbols_variable_scope_ops = [
    "get_local_variable",  # Documented in framework package.
]

_allowed_symbols_misc = [
    "deserialize_many_sparse",
    "parse_single_sequence_example",
    "serialize_many_sparse",
    "serialize_sparse",
    "confusion_matrix",
]

_allowed_symbols = (_allowed_symbols_array_ops +
                    _allowed_symbols_clip_ops +
                    _allowed_symbols_control_flow_ops +
                    _allowed_symbols_functional_ops +
                    _allowed_symbols_image_ops +
                    _allowed_symbols_gradients +
                    _allowed_symbols_math_ops +
                    _allowed_symbols_variable_scope_ops +
                    _allowed_symbols_misc +
                    _allowed_symbols_partitioned_variables)

remove_undocumented(__name__, _allowed_symbols, [
    _sys.modules[__name__],
    _array_ops,
    _check_ops,
    _clip_ops,
    _confusion_matrix,
    _control_flow_ops,
    _constant_op,
    _data_flow_ops,
    _functional_ops,
    _gradients,
    _histogram_ops,
    _init_ops,
    _io_ops,
    _linalg_ops,
    _logging_ops,
    _manip_ops,
    _math_ops,
    _numerics,
    _parsing_ops,
    _partitioned_variables,
    _random_ops,
    _script_ops,
    _session_ops,
    _sparse_ops,
    _special_math_ops,
    _state_ops,
    _string_ops,
    _template,
    _tensor_array_ops,
    _variable_scope,
    _variables,
])