MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / VariableScope

Class VariableScope

tensorflow/python/ops/variable_scope.py:1293–1785  ·  view source on GitHub ↗

Variable scope object to carry defaults to provide to `get_variable`. Many of the arguments we need for `get_variable` in a variable store are most easily handled with a context. This object is used for the defaults. Attributes: name: name of the current scope, used as prefix in get_vari

Source from the content-addressed store, hash-verified

1291# TODO(alive): support caching devices and partitioned variables in Eager mode.
1292@tf_export(v1=["VariableScope"])
1293class VariableScope(object):
1294 """Variable scope object to carry defaults to provide to `get_variable`.
1295
1296 Many of the arguments we need for `get_variable` in a variable store are most
1297 easily handled with a context. This object is used for the defaults.
1298
1299 Attributes:
1300 name: name of the current scope, used as prefix in get_variable.
1301 initializer: default initializer passed to get_variable.
1302 regularizer: default regularizer passed to get_variable.
1303 reuse: Boolean, None, or tf.compat.v1.AUTO_REUSE, setting the reuse in
1304 get_variable. When eager execution is enabled this argument is always
1305 forced to be False.
1306 caching_device: string, callable, or None: the caching device passed to
1307 get_variable.
1308 partitioner: callable or `None`: the partitioner passed to `get_variable`.
1309 custom_getter: default custom getter passed to get_variable.
1310 name_scope: The name passed to `tf.name_scope`.
1311 dtype: default type passed to get_variable (defaults to DT_FLOAT).
1312 use_resource: if False, create a normal Variable; if True create an
1313 experimental ResourceVariable with well-defined semantics. Defaults to
1314 False (will later change to True). When eager execution is enabled this
1315 argument is always forced to be True.
1316 constraint: An optional projection function to be applied to the variable
1317 after being updated by an `Optimizer` (e.g. used to implement norm
1318 constraints or value constraints for layer weights). The function must
1319 take as input the unprojected Tensor representing the value of the
1320 variable and return the Tensor for the projected value (which must have
1321 the same shape). Constraints are not safe to use when doing asynchronous
1322 distributed training.
1323 """
1324
1325 def __init__(self,
1326 reuse,
1327 name="",
1328 initializer=None,
1329 regularizer=None,
1330 caching_device=None,
1331 partitioner=None,
1332 custom_getter=None,
1333 name_scope="",
1334 dtype=dtypes.float32,
1335 use_resource=None,
1336 constraint=None):
1337 """Creates a new VariableScope with the given properties."""
1338 self._name = name
1339 self._initializer = initializer
1340 self._regularizer = regularizer
1341 self._reuse = reuse
1342 self._caching_device = caching_device
1343 self._partitioner = partitioner
1344 self._custom_getter = custom_getter
1345 self._name_scope = name_scope
1346 self._dtype = dtype
1347 self._use_resource = use_resource
1348 self._constraint = constraint
1349 if context.executing_eagerly():
1350 if self._caching_device is not None:

Callers 3

__init__Method · 0.85
__init__Method · 0.85
__enter__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected