aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/python/ops/variable_scope.py
diff options
context:
space:
mode:
authorGravatar Anna R <annarev@google.com>2018-01-22 17:16:44 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-01-22 17:22:31 -0800
commit2968447d32bdfd0dd6fafabfcd1aafd6dc261803 (patch)
treeca1432cc15d217f8b3e1881b4461cd602657382b /tensorflow/python/ops/variable_scope.py
parentf5356644fd3467afa275ec2155281825b7e927a0 (diff)
Adding tf_export decorators/calls to TensorFlow functions and constants.
PiperOrigin-RevId: 182862075
Diffstat (limited to 'tensorflow/python/ops/variable_scope.py')
-rw-r--r--tensorflow/python/ops/variable_scope.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/tensorflow/python/ops/variable_scope.py b/tensorflow/python/ops/variable_scope.py
index 1facb8b1f2..c52d5fff5d 100644
--- a/tensorflow/python/ops/variable_scope.py
+++ b/tensorflow/python/ops/variable_scope.py
@@ -40,6 +40,7 @@ from tensorflow.python.ops import resource_variable_ops
from tensorflow.python.ops import variables
from tensorflow.python.platform import tf_logging as logging
from tensorflow.python.util import tf_contextlib
+from tensorflow.python.util.tf_export import tf_export
__all__ = ["AUTO_REUSE", "VariableScope", "get_variable_scope",
"get_variable", "get_local_variable", "variable_scope",
@@ -186,6 +187,7 @@ class _ReuseMode(enum.Enum):
# REUSE_TRUE = 3
AUTO_REUSE = _ReuseMode.AUTO_REUSE
+tf_export("AUTO_REUSE").export_constant(__name__, "AUTO_REUSE")
AUTO_REUSE.__doc__ = """
When passed in as the value for the `reuse` flag, AUTO_REUSE indicates that
get_variable() should create the requested variable if it doesn't exist or, if
@@ -853,12 +855,14 @@ class _VariableStore(object):
# To stop regularization, use this regularizer
+@tf_export("no_regularizer")
def no_regularizer(_):
"""Use this function to prevent regularization of variables."""
return None
# TODO(alive): support caching devices and partitioned variables in Eager mode.
+@tf_export("VariableScope")
class VariableScope(object):
"""Variable scope object to carry defaults to provide to `get_variable`.
@@ -1158,6 +1162,7 @@ _VARSTORE_KEY = ("__variable_store",)
_VARSCOPE_KEY = ("__varscope",)
+@tf_export("get_variable_scope")
def get_variable_scope():
"""Returns the current variable scope."""
scope = ops.get_collection(_VARSCOPE_KEY)
@@ -1238,6 +1243,7 @@ class EagerVariableStore(object):
# pylint: enable=protected-access
+@tf_export("get_variable")
def get_variable(name,
shape=None,
dtype=None,
@@ -1349,6 +1355,7 @@ get_variable.__doc__ = get_variable_or_local_docstring % (
@functools.wraps(get_variable)
+@tf_export("get_local_variable")
def get_local_variable(*args, **kwargs):
kwargs["trainable"] = False
if "collections" in kwargs:
@@ -1663,7 +1670,8 @@ def _get_unique_variable_scope(prefix):
# Named like a function for backwards compatibility with the
# @tf_contextlib.contextmanager version, which was switched to a class to avoid
# some object creation overhead.
-class variable_scope(object): # pylint: disable=invalid-name
+@tf_export("variable_scope") # pylint: disable=invalid-name
+class variable_scope(object):
"""A context manager for defining ops that creates variables (layers).
This context manager validates that the (optional) `values` are from the same
@@ -1996,6 +2004,7 @@ class variable_scope(object): # pylint: disable=invalid-name
# pylint: disable=g-doc-return-or-yield
+@tf_export("variable_op_scope")
@tf_contextlib.contextmanager
def variable_op_scope(values,
name_or_scope,