Seal contrib interfaces (as much a feasible). If you were using a symbol which is now hidden, it should be added to the _allowed_symbols list in the appropriate __init__.py file.

Change: 145943844
This commit is contained in:
Martin Wicke 2017-01-29 17:50:23 -08:00
parent 59ad9529ba
commit daa030ed68
46 changed files with 500 additions and 308 deletions

View File

@ -58,3 +58,7 @@ from tensorflow.contrib import training
from tensorflow.contrib import util
from tensorflow.contrib.ndlstm import python as ndlstm
from tensorflow.contrib.specs import python as specs
del absolute_import
del division
del print_function

View File

@ -30,3 +30,13 @@ from tensorflow.contrib.bayesflow.python.ops import stochastic_tensor
from tensorflow.contrib.bayesflow.python.ops import stochastic_variables
from tensorflow.contrib.bayesflow.python.ops import variational_inference
# pylint: enable=unused-import,line-too-long
from tensorflow.python.util.all_util import remove_undocumented
_allowed_symbols = ['entropy', 'monte_carlo',
'special_math', 'stochastic_gradient_estimators',
'stochastic_graph', 'stochastic_tensor',
'stochastic_variables', 'variational_inference']
remove_undocumented(__name__, _allowed_symbols)

View File

@ -20,4 +20,9 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.copy_graph.python.util import copy_elements
from tensorflow.contrib.copy_graph.python.util.copy_elements import *
from tensorflow.python.util.all_util import remove_undocumented
remove_undocumented(__name__, doc_string_modules=[copy_elements])

View File

@ -37,3 +37,7 @@ from tensorflow.contrib.crf.python.ops.crf import crf_sequence_score
from tensorflow.contrib.crf.python.ops.crf import crf_unary_score
from tensorflow.contrib.crf.python.ops.crf import CrfForwardRnnCell
from tensorflow.contrib.crf.python.ops.crf import viterbi_decode
from tensorflow.python.util.all_util import remove_undocumented
remove_undocumented(__name__)

View File

@ -23,3 +23,6 @@ from tensorflow.contrib.cudnn_rnn.python.ops.cudnn_rnn_ops import CudnnLSTM
from tensorflow.contrib.cudnn_rnn.python.ops.cudnn_rnn_ops import CudnnRNNRelu
from tensorflow.contrib.cudnn_rnn.python.ops.cudnn_rnn_ops import CudnnRNNTanh
from tensorflow.contrib.cudnn_rnn.python.ops.cudnn_rnn_ops import RNNParamsSaveable
from tensorflow.python.util.all_util import remove_undocumented
remove_undocumented(__name__)

View File

@ -95,3 +95,10 @@ from tensorflow.python.ops.logging_ops import merge_all_summaries
from tensorflow.python.ops.logging_ops import merge_summary
from tensorflow.python.ops.logging_ops import scalar_summary
# pylint: enable=unused-import,line-too-long
from tensorflow.python.util.all_util import remove_undocumented
_allowed_symbols = ['audio_summary', 'histogram_summary',
'image_summary', 'merge_all_summaries',
'merge_summary', 'scalar_summary']
remove_undocumented(__name__, _allowed_symbols)

View File

@ -134,3 +134,12 @@ from tensorflow.contrib.distributions.python.ops.uniform import *
from tensorflow.contrib.distributions.python.ops.wishart import *
# pylint: enable=unused-import,wildcard-import,line-too-long,g-importing-member
from tensorflow.python.util.all_util import remove_undocumented
_allowed_symbols = ['bijector',
'ConditionalDistribution',
'ConditionalTransformedDistribution',
'FULLY_REPARAMETERIZED', 'NOT_REPARAMETERIZED']
remove_undocumented(__name__, _allowed_symbols)

View File

@ -132,3 +132,7 @@ from tensorflow.contrib.graph_editor import util as _util
ph = _util.make_placeholder_from_dtype_and_shape
sgv = _subgraph.make_view
sgv_scope = _subgraph.make_view_from_scope
del absolute_import
del division
del print_function

View File

@ -12,8 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Various ways of selecting operations and tensors in a graph.
"""
"""Various ways of selecting operations and tensors in a graph."""
from __future__ import absolute_import
from __future__ import division

View File

@ -21,8 +21,8 @@ transforms (including rotation) are supported.
## Image `Ops`
@@ rotate
@@ transform
@@rotate
@@transform
"""
from __future__ import absolute_import
from __future__ import division
@ -31,3 +31,8 @@ from __future__ import print_function
# pylint: disable=line-too-long
from tensorflow.contrib.image.python.ops.image_ops import rotate
from tensorflow.contrib.image.python.ops.image_ops import transform
from tensorflow.python.util.all_util import remove_undocumented
remove_undocumented(__name__)

View File

@ -52,7 +52,7 @@ tf_kernel_library(
py_library(
name = "input_pipeline_py",
srcs = glob(["python/ops/*.py"]),
srcs = glob(["python/ops/*.py"]) + ["__init__.py"],
data = [":python/ops/_input_pipeline_ops.so"],
srcs_version = "PY2AND3",
deps = [

View File

@ -15,11 +15,12 @@
"""Ops and modules related to input_pipeline.
@@obtain_next
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.input_pipeline.python.ops.input_pipeline_ops import obtain_next
from tensorflow.python.util.all_util import remove_undocumented
remove_undocumented(__name__)

View File

@ -59,6 +59,7 @@ from __future__ import print_function
# pylint: disable=wildcard-import
from tensorflow.contrib.integrate.python.ops.odes import *
from tensorflow.python.util.all_util import make_all
from tensorflow.python.util.all_util import remove_undocumented
__all__ = make_all(__name__)
remove_undocumented(__name__)

View File

@ -23,17 +23,27 @@ common machine learning algorithms.
@@avg_pool2d
@@batch_norm
@@convolution2d
@@conv2d_in_plane
@@convolution2d_in_plane
@@conv2d_transpose
@@convolution2d_transpose
@@dropout
@@flatten
@@fully_connected
@@layer_norm
@@linear
@@max_pool2d
@@one_hot_encoding
@@relu
@@relu6
@@repeat
@@safe_embedding_lookup_sparse
@@separable_conv2d
@@separable_convolution2d
@@softmax
@@stack
@@unit_norm
@@embed_sequence
Aliases for fully_connected which set a default activation function are
available: `relu`, `relu6` and `linear`.
@ -95,6 +105,7 @@ Feature columns provide a mechanism to map data to a model.
@@input_from_feature_columns
@@joint_weighted_sum_from_feature_columns
@@make_place_holder_tensors_for_base_features
@@multi_class_target
@@one_hot_column
@@parse_feature_columns_from_examples
@@parse_feature_columns_from_sequence_examples
@ -105,6 +116,8 @@ Feature columns provide a mechanism to map data to a model.
@@sparse_column_with_keys
@@weighted_sparse_column
@@weighted_sum_from_feature_columns
@@infer_real_valued_columns
@@sequence_input_from_feature_columns
"""
@ -112,16 +125,21 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
# pylint: disable=unused-import,wildcard-import
from tensorflow.contrib.layers.python.layers import *
from tensorflow.contrib.layers.python.ops import sparse_ops
from tensorflow.python.util.all_util import make_all
# pylint: enable=unused-import,wildcard-import
from tensorflow.python.util.all_util import remove_undocumented
# Note: `stack` operation is available, just excluded from the document above
# due to collision with tf.stack.
_allowed_symbols = ['bias_add',
'conv2d',
'feature_column',
'legacy_fully_connected',
'legacy_linear',
'legacy_relu',
'OPTIMIZER_CLS_NAMES',
'regression_target',
'SPARSE_FEATURE_CROSS_DEFAULT_HASH_KEY',
'summaries']
__all__ = make_all(__name__)
remove_undocumented(__name__, _allowed_symbols)

View File

@ -122,11 +122,11 @@ import math
import six
from tensorflow.contrib import lookup
from tensorflow.contrib.layers.python.layers import layers
from tensorflow.contrib.layers.python.ops import bucketization_op
from tensorflow.contrib.layers.python.ops import sparse_feature_cross_op
from tensorflow.contrib.layers.python.ops import sparse_ops as contrib_sparse_ops
from tensorflow.contrib.lookup import lookup_ops as contrib_lookup_ops
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import sparse_tensor as sparse_tensor_py
from tensorflow.python.ops import array_ops
@ -587,7 +587,7 @@ class _SparseColumnKeys(_SparseColumn):
"""Handles sparse column to id conversion."""
input_tensor = self._get_input_sparse_tensor(columns_to_tensors)
table = contrib_lookup_ops.string_to_index_table_from_tensor(
table = lookup.string_to_index_table_from_tensor(
mapping=list(self.lookup_config.keys),
default_value=self.lookup_config.default_value,
name="lookup")
@ -662,7 +662,7 @@ class _SparseColumnVocabulary(_SparseColumn):
else:
sparse_string_tensor = st
table = contrib_lookup_ops.string_to_index_table_from_file(
table = lookup.string_to_index_table_from_file(
vocabulary_file=self.lookup_config.vocabulary_file,
num_oov_buckets=self.lookup_config.num_oov_buckets,
vocab_size=self.lookup_config.vocab_size,

View File

@ -23,15 +23,18 @@ import os
import sys
import tempfile
# TODO: #6568 Remove this hack that makes dlopen() not crash.
# pylint: disable=g-bad-todo
# TODO(#6568): Remove this hack that makes dlopen() not crash.
# pylint: enable=g-bad-todo
# pylint: disable=g-import-not-at-top
if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"):
import ctypes
sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL)
import numpy as np
from tensorflow.contrib.layers.python.layers import feature_column as fc
from tensorflow.contrib.layers.python.layers import feature_column_ops
import tensorflow.contrib.layers.python.layers.feature_column as fc
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import sparse_tensor as sparse_tensor_lib

View File

@ -24,13 +24,24 @@ Train and evaluate TensorFlow models.
@@Estimator
@@Trainable
@@Evaluable
@@KMeansClustering
@@ModeKeys
@@ModelFnOps
@@MetricSpec
@@PredictionKey
@@DNNClassifier
@@DNNRegressor
@@DNNLinearCombinedRegressor
@@DNNLinearCombinedClassifier
@@LinearClassifier
@@LinearRegressor
@@LogisticRegressor
## Distributed training utilities
@@Experiment
@@ExportStrategy
@@TaskType
## Graph actions
Perform various training, evaluation, and inference actions on a graph.
@ -58,6 +69,10 @@ Queue and read batched input data.
@@read_batch_features
@@read_batch_record_features
Export utilities
@@build_parsing_serving_input_fn
@@ProblemType
"""
from __future__ import absolute_import
@ -67,7 +82,11 @@ from __future__ import print_function
# pylint: disable=wildcard-import
from tensorflow.contrib.learn.python.learn import *
# pylint: enable=wildcard-import
from tensorflow.python.util.all_util import make_all
__all__ = make_all(__name__)
__all__.append('datasets')
from tensorflow.python.util.all_util import remove_undocumented
_allowed_symbols = ['datasets', 'head', 'io', 'models',
'monitors', 'NotFittedError', 'ops', 'preprocessing',
'utils', 'graph_actions']
remove_undocumented(__name__, _allowed_symbols)

View File

@ -19,8 +19,6 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
# pylint: disable=wildcard-import
from tensorflow.contrib.learn.python.learn import basic_session_run_hooks
from tensorflow.contrib.learn.python.learn import datasets

View File

@ -12,10 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Some common SessionRunHook classes.
@@
"""
"""Some common SessionRunHook classes."""
from __future__ import absolute_import
from __future__ import division

View File

@ -306,6 +306,7 @@ from __future__ import division
from __future__ import print_function
from tensorflow.contrib.learn.python.learn.estimators._sklearn import NotFittedError
from tensorflow.contrib.learn.python.learn.estimators.constants import ProblemType
from tensorflow.contrib.learn.python.learn.estimators.dnn import DNNClassifier
from tensorflow.contrib.learn.python.learn.estimators.dnn import DNNRegressor
from tensorflow.contrib.learn.python.learn.estimators.dnn_linear_combined import DNNLinearCombinedClassifier

View File

@ -25,7 +25,10 @@ import os
import sys
import tempfile
# TODO: #6568 Remove this hack that makes dlopen() not crash.
# pylint: disable=g-bad-todo
# TODO(#6568): Remove this hack that makes dlopen() not crash.
# pylint: enable=g-bad-todo
# pylint: disable=g-import-not-at-top
if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'setdlopenflags'):
import ctypes
sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL)
@ -35,6 +38,7 @@ import six
from six.moves import xrange # pylint: disable=redefined-builtin
from tensorflow.contrib import learn
from tensorflow.contrib import lookup
from tensorflow.contrib.framework.python.ops import variables
from tensorflow.contrib.layers.python.layers import feature_column as feature_column_lib
from tensorflow.contrib.layers.python.layers import optimizers
@ -48,7 +52,6 @@ from tensorflow.contrib.learn.python.learn.estimators import linear
from tensorflow.contrib.learn.python.learn.estimators import model_fn
from tensorflow.contrib.learn.python.learn.estimators import run_config
from tensorflow.contrib.learn.python.learn.utils import input_fn_utils
from tensorflow.contrib.lookup import lookup_ops
from tensorflow.contrib.metrics.python.ops import metric_ops
from tensorflow.contrib.testing.python.framework import util_test
from tensorflow.python.client import session as session_lib
@ -221,8 +224,8 @@ def _build_estimator_for_export_tests(tmpdir):
vocab_file = gfile.GFile(vocab_file_name, mode='w')
vocab_file.write(VOCAB_FILE_CONTENT)
vocab_file.close()
hashtable = lookup_ops.HashTable(
lookup_ops.TextFileStringTableInitializer(vocab_file_name), 'x')
hashtable = lookup.HashTable(
lookup.TextFileStringTableInitializer(vocab_file_name), 'x')
features['bogus_lookup'] = hashtable.lookup(
math_ops.to_int64(features['feature']))
@ -878,8 +881,8 @@ class ReplicaDeviceSetterTest(test.TestCase):
with ops.device(estimator._get_replica_device_setter(config)):
default_val = constant_op.constant([-1, -1], dtypes.int64)
table = lookup_ops.MutableHashTable(dtypes.string, dtypes.int64,
default_val)
table = lookup.MutableHashTable(dtypes.string, dtypes.int64,
default_val)
input_string = constant_op.constant(['brain', 'salad', 'tank'])
output = table.lookup(input_string)
self.assertDeviceEqual('/job:ps/task:0', table._table_ref.device)
@ -889,8 +892,8 @@ class ReplicaDeviceSetterTest(test.TestCase):
with ops.device(
estimator._get_replica_device_setter(run_config.RunConfig())):
default_val = constant_op.constant([-1, -1], dtypes.int64)
table = lookup_ops.MutableHashTable(dtypes.string, dtypes.int64,
default_val)
table = lookup.MutableHashTable(dtypes.string, dtypes.int64,
default_val)
input_string = constant_op.constant(['brain', 'salad', 'tank'])
output = table.lookup(input_string)
self.assertDeviceEqual('', table._table_ref.device)

View File

@ -97,7 +97,7 @@ def numpy_input_fn(x,
shape_dict_of_x = {k: x[k].shape for k in x.keys()}
shape_of_y = None if y is None else y.shape
raise ValueError('Length of tensors in x and y is mismatched. All '
'elementson x and y must have the same length.\n'
'elements in x and y must have the same length.\n'
'Shapes in x: {}\n'
'Shape for y: {}\n'.format(shape_dict_of_x, shape_of_y))

View File

@ -27,7 +27,7 @@ if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"):
import numpy as np
import tensorflow.contrib.learn.python.learn.dataframe.queues.feeding_functions as ff
from tensorflow.contrib.learn.python.learn.dataframe.queues import feeding_functions as ff
from tensorflow.python.platform import test
# pylint: disable=g-import-not-at-top

View File

@ -27,7 +27,7 @@ if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"):
import numpy as np
import tensorflow.contrib.learn.python.learn.dataframe.queues.feeding_functions as ff
from tensorflow.contrib.learn.python.learn.dataframe.queues import feeding_functions as ff
from tensorflow.python.client import session
from tensorflow.python.framework import ops
from tensorflow.python.platform import test

View File

@ -24,7 +24,8 @@ if hasattr(sys, "getdlopenflags") and hasattr(sys, "setdlopenflags"):
import ctypes
sys.setdlopenflags(sys.getdlopenflags() | ctypes.RTLD_GLOBAL)
import tensorflow.contrib.learn.python.learn.dataframe.transforms.reader_source as rs
# pylint: disable=g-import-not-at-top
from tensorflow.contrib.learn.python.learn.dataframe.transforms import reader_source as rs
from tensorflow.python.ops import io_ops
from tensorflow.python.ops import variables
from tensorflow.python.platform import test

View File

@ -54,3 +54,6 @@ from tensorflow.contrib.linalg.python.ops.linear_operator_matrix import *
from tensorflow.contrib.linalg.python.ops.linear_operator_tril import *
# pylint: enable=unused-import,wildcard-import,line-too-long,g-importing-member
from tensorflow.python.util.all_util import remove_undocumented
remove_undocumented(__name__)

View File

@ -22,7 +22,7 @@ import abc
import numpy as np
import six
from tensorflow.contrib.framework import tensor_util as contrib_tensor_util
from tensorflow.contrib.framework.python.framework import tensor_util as contrib_tensor_util
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from tensorflow.python.framework import random_seed

View File

@ -17,6 +17,8 @@
## This package provides optimizers to train linear models.
@@SdcaModel
@@SparseFeatureColumn
@@SDCAOptimizer
"""
from __future__ import absolute_import
from __future__ import division
@ -25,3 +27,6 @@ from __future__ import print_function
from tensorflow.contrib.linear_optimizer.python.ops.sdca_ops import SdcaModel
from tensorflow.contrib.linear_optimizer.python.ops.sparse_feature_column import SparseFeatureColumn
from tensorflow.contrib.linear_optimizer.python.sdca_optimizer import SDCAOptimizer
from tensorflow.python.util.all_util import remove_undocumented
remove_undocumented(__name__)

View File

@ -20,7 +20,7 @@ from __future__ import print_function
from six.moves import range
from tensorflow.contrib.lookup import lookup_ops
from tensorflow.contrib import lookup
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from tensorflow.python.framework import tensor_shape
@ -30,7 +30,7 @@ from tensorflow.python.ops import data_flow_ops
from tensorflow.python.ops import math_ops
class ShardedMutableDenseHashTable(lookup_ops.LookupInterface):
class ShardedMutableDenseHashTable(lookup.LookupInterface):
"""A sharded version of MutableDenseHashTable.
It is designed to be interface compatible with LookupInterface and
@ -41,7 +41,7 @@ class ShardedMutableDenseHashTable(lookup_ops.LookupInterface):
internally. The shard is computed via the modulo operation on the key.
"""
# TODO(andreasst): consider moving this to lookup_ops
# TODO(andreasst): consider moving this to lookup module
def __init__(self,
key_dtype,
@ -56,7 +56,7 @@ class ShardedMutableDenseHashTable(lookup_ops.LookupInterface):
table_shards = []
for i in range(num_shards):
table_shards.append(
lookup_ops.MutableDenseHashTable(
lookup.MutableDenseHashTable(
key_dtype=key_dtype,
value_dtype=value_dtype,
default_value=default_value,

View File

@ -25,6 +25,7 @@
@@IdTableWithHashBuckets
@@HashTable
@@MutableHashTable
@@MutableDenseHashTable
@@TableInitializerBase
@@KeyValueTensorInitializer
@@TextFileIndex
@ -32,6 +33,9 @@
@@TextFileIdTableInitializer
@@TextFileStringTableInitializer
@@HasherSpec
@@StrongHashSpec
@@FastHashSpec
"""
from __future__ import absolute_import
@ -41,3 +45,6 @@ from __future__ import print_function
# pylint: disable=unused-import,wildcard-import
from tensorflow.contrib.lookup.lookup_ops import *
# pylint: enable=unused-import,wildcard-import
from tensorflow.python.util.all_util import remove_undocumented
remove_undocumented(__name__)

File diff suppressed because it is too large Load Diff

View File

@ -19,8 +19,10 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
# pylint: disable=unused-import,wildcard-import
from tensorflow.contrib.losses.python import losses
from tensorflow.contrib.losses.python.losses import *
# pylint: enable=unused-import,wildcard-import
from tensorflow.python.util.all_util import remove_undocumented
remove_undocumented(__name__, doc_string_modules=[losses])

View File

@ -109,6 +109,7 @@ labels and predictions tensors and results in a weighted average of the metric.
@@streaming_mean_iou
@@streaming_mean_relative_error
@@streaming_mean_squared_error
@@streaming_mean_tensor
@@streaming_root_mean_squared_error
@@streaming_covariance
@@streaming_pearson_correlation
@ -137,6 +138,8 @@ labels and predictions tensors and results in a weighted average of the metric.
@@aggregate_metrics
@@aggregate_metric_map
@@confusion_matrix
## Set `Ops`
@@set_difference
@ -193,7 +196,7 @@ from tensorflow.contrib.metrics.python.ops.set_ops import set_difference
from tensorflow.contrib.metrics.python.ops.set_ops import set_intersection
from tensorflow.contrib.metrics.python.ops.set_ops import set_size
from tensorflow.contrib.metrics.python.ops.set_ops import set_union
from tensorflow.python.util.all_util import make_all
# pylint: enable=unused-import,line-too-long
__all__ = make_all(__name__)
from tensorflow.python.util.all_util import remove_undocumented
remove_undocumented(__name__)

View File

@ -23,7 +23,7 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.framework import tensor_util
from tensorflow.contrib.framework.python.framework import tensor_util
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops

View File

@ -23,7 +23,7 @@ from __future__ import division
from __future__ import print_function
from tensorflow.contrib.framework import deprecated
from tensorflow.contrib.framework import tensor_util
from tensorflow.contrib.framework.python.framework import tensor_util
from tensorflow.contrib.framework.python.ops import variables as contrib_variables
from tensorflow.contrib.metrics.python.ops import set_ops
from tensorflow.python.framework import dtypes

View File

@ -4593,7 +4593,7 @@ class StreamingConcatTest(test.TestCase):
self.assertListEqual(ops.get_collection(my_collection_name), [update_op])
def testNextArraySize(self):
next_array_size = metrics.python.ops.metric_ops._next_array_size
next_array_size = metric_ops._next_array_size # pylint: disable=protected-access
with self.test_session():
self.assertEqual(next_array_size(2, growth_factor=2).eval(), 2)
self.assertEqual(next_array_size(3, growth_factor=2).eval(), 4)

View File

@ -12,7 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Module for deprecated ops in tf.nn."""
"""Module for deprecated ops in tf.nn.
@@deprecated_flipped_softmax_cross_entropy_with_logits
@@deprecated_flipped_sparse_softmax_cross_entropy_with_logits
@@deprecated_flipped_sigmoid_cross_entropy_with_logits
"""
from __future__ import absolute_import
from __future__ import division
@ -21,3 +26,6 @@ from __future__ import print_function
# pylint: disable=unused-import,wildcard-import
from tensorflow.contrib.nn.python.ops.cross_entropy import *
# pylint: enable=unused-import,wildcard-import
from tensorflow.python.util.all_util import remove_undocumented
remove_undocumented(__name__)

View File

@ -23,3 +23,12 @@ from tensorflow.contrib.opt.python.training.external_optimizer import *
from tensorflow.contrib.opt.python.training.moving_average_optimizer import *
from tensorflow.contrib.opt.python.training.variable_clipping_optimizer import *
# pylint: enable=wildcard-import
from tensorflow.python.util.all_util import remove_undocumented
_allowed_symbols = ['ExternalOptimizerInterface',
'MovingAverageOptimizer',
'ScipyOptimizerInterface',
'VariableClippingOptimizer']
remove_undocumented(__name__, _allowed_symbols)

View File

@ -24,6 +24,7 @@
@@BasicLSTMCell
@@GRUCell
@@LSTMCell
@@LayerNormBasicLSTMCell
## Classes storing split `RNNCell` state
@ -32,6 +33,7 @@
## RNN Cell wrappers (RNNCells that wrap other RNNCells)
@@MultiRNNCell
@@LSTMBlockWrapper
@@DropoutWrapper
@@EmbeddingWrapper
@@InputProjectionWrapper
@ -86,10 +88,13 @@ from tensorflow.contrib.rnn.python.ops.core_rnn_cell import MultiRNNCell
from tensorflow.contrib.rnn.python.ops.core_rnn_cell import OutputProjectionWrapper
from tensorflow.contrib.rnn.python.ops.core_rnn_cell import RNNCell
# pylint: disable=unused-import,wildcard-import, line-too-long
# pylint: disable=unused-import,wildcard-import,line-too-long
from tensorflow.contrib.rnn.python.ops.fused_rnn_cell import *
from tensorflow.contrib.rnn.python.ops.gru_ops import *
from tensorflow.contrib.rnn.python.ops.lstm_ops import *
from tensorflow.contrib.rnn.python.ops.rnn import *
from tensorflow.contrib.rnn.python.ops.rnn_cell import *
# pylint: enable=unused-import,wildcard-import,line-too-long
from tensorflow.python.util.all_util import remove_undocumented
remove_undocumented(__name__, ['core_rnn_cell'])

View File

@ -19,13 +19,23 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
# pylint: disable=unused-import,line-too-long
# pylint: disable=unused-import,wildcard-import,line-too-long
from tensorflow.contrib.seq2seq.python.ops.attention_decoder_fn import attention_decoder_fn_inference
from tensorflow.contrib.seq2seq.python.ops.attention_decoder_fn import attention_decoder_fn_train
from tensorflow.contrib.seq2seq.python.ops.attention_decoder_fn import prepare_attention
from tensorflow.contrib.seq2seq.python.ops.decoder_fn import *
from tensorflow.contrib.seq2seq.python.ops.loss import *
from tensorflow.contrib.seq2seq.python.ops.seq2seq import *
# pylint: enable=unused-import,line-too-long
# pylint: enable=unused-import,widcard-import,line-too-long
from tensorflow.python.util.all_util import remove_undocumented
_allowed_symbols = ["attention_decoder_fn_inference",
"attention_decoder_fn_train",
"dynamic_rnn_decoder",
"prepare_attention",
"sequence_loss",
"simple_decoder_fn_train",
"simple_decoder_fn_inference"]
remove_undocumented(__name__, _allowed_symbols)

View File

@ -25,3 +25,10 @@ from __future__ import print_function
from tensorflow.python.pywrap_tensorflow import DeleteStatSummarizer
from tensorflow.python.pywrap_tensorflow import NewStatSummarizer
from tensorflow.python.pywrap_tensorflow import StatSummarizer
from tensorflow.python.util.all_util import remove_undocumented
_allowed_symbols = ['DeleteStatSummarizer', 'NewStatSummarizer',
'StatSummarizer']
remove_undocumented(__name__, _allowed_symbols)

View File

@ -19,4 +19,3 @@ from __future__ import print_function
from tensorflow.contrib.tfprof.python.tools.tfprof import model_analyzer
from tensorflow.contrib.tfprof.python.tools.tfprof import tfprof_logger
from tensorflow.python.util.all_util import make_all

View File

@ -35,7 +35,6 @@ from tensorflow.python.framework.meta_graph import stripped_op_list_for_graph
from tensorflow.python.framework.tensor_util import constant_value
from tensorflow.python.framework.tensor_util import make_tensor_proto
from tensorflow.python.framework.tensor_util import MakeNdarray as make_ndarray
from tensorflow.python.util.all_util import make_all
__all__ = make_all(__name__)
# pylint: disable=unused_import
from tensorflow.python.util.all_util import remove_undocumented
remove_undocumented(__name__)

View File

@ -12,7 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Utilities for loading op libraries."""
"""Utilities for loading op libraries.
@@load_op_library
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

View File

@ -291,10 +291,43 @@ class Library(Document):
def _generate_signature_for_function(self, func):
"""Given a function, returns a string representing its args."""
args_list = []
argspec = inspect.getargspec(func)
if isinstance(func, functools.partial):
argspec = inspect.getargspec(func.func)
# Remove the args from the original function that have been used up.
first_default_arg = (
len(argspec.args or []) - len(argspec.defaults or []))
partial_args = len(func.args)
if argspec.args:
argspec_args = list(argspec.args[partial_args:])
else:
argspec_args = []
if argspec.defaults:
argspec_defaults = list(argspec.defaults[
max(0, partial_args-first_default_arg):])
else:
argspec_defaults = []
first_default_arg = max(0, first_default_arg - partial_args)
for kwarg in func.keywords:
if kwarg in argspec_args:
i = argspec_args.index(kwarg)
argspec_args.pop(i)
if i >= first_default_arg:
argspec_defaults.pop(i-first_default_arg)
else:
first_default_arg -= 1
argspec_varargs = None
argspec_keywords = None
else:
argspec = inspect.getargspec(func)
argspec_args = argspec.args
argspec_defaults = argspec.defaults
argspec_varargs = argspec.varargs
argspec_keywords = argspec.keywords
first_arg_with_default = (
len(argspec.args or []) - len(argspec.defaults or []))
for arg in argspec.args[:first_arg_with_default]:
len(argspec_args or []) - len(argspec_defaults or []))
for arg in argspec_args[:first_arg_with_default]:
if arg == "self":
# Python documentation typically skips `self` when printing method
# signatures.
@ -306,16 +339,16 @@ class Library(Document):
# TODO(aselle): This workaround is brittle on TestCase.__call__
# so we need to wrap this in a try/catch
# We should do something better.
if argspec.varargs == "args" and argspec.keywords == "kwds":
if argspec_varargs == "args" and argspec_keywords == "kwds":
try:
original_func = func.__closure__[0].cell_contents
return self._generate_signature_for_function(original_func)
except TypeError:
pass
if argspec.defaults:
if argspec_defaults:
for arg, default in zip(
argspec.args[first_arg_with_default:], argspec.defaults):
argspec_args[first_arg_with_default:], argspec_defaults):
if callable(default):
if hasattr(default, "__name__"):
args_list.append("%s=%s" % (arg, default.__name__))
@ -326,10 +359,10 @@ class Library(Document):
args_list.append("%s=%s()" % (arg, default.__class__.__name__))
else:
args_list.append("%s=%r" % (arg, default))
if argspec.varargs:
args_list.append("*" + argspec.varargs)
if argspec.keywords:
args_list.append("**" + argspec.keywords)
if argspec_varargs:
args_list.append("*" + argspec_varargs)
if argspec_keywords:
args_list.append("**" + argspec_keywords)
return "(" + ", ".join(args_list) + ")"
def _remove_docstring_indent(self, docstring):

View File

@ -261,11 +261,18 @@ _hidden_symbols = ["Event", "LogMessage", "Summary", "SessionLog", "xrange",
# TODO(wicke): Remove contrib.layers.relu* after shortnames are
# disabled. These conflict with tf.nn.relu*
EXCLUDE = frozenset(["tf.contrib.learn.monitors.NanLossDuringTrainingError",
"tf.contrib.layers.dropout",
"tf.contrib.layers.bias_add",
"tf.contrib.layers.conv2d",
"tf.contrib.layers.conv2d_transpose",
"tf.contrib.layers.separable_conv2d",
"tf.contrib.layers.softmax",
"tf.contrib.layers.relu", "tf.contrib.layers.relu6",
"tf.contrib.framework.assert_global_step",
"tf.contrib.framework.get_global_step",
"tf.contrib.learn.NanLossDuringTrainingError",
"tf.contrib.layers.stack",
"tf.contrib.layers.ProblemType",
"tf.confusion_matrix"])