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.

name name of the current scope, used as prefix in get_variable.
initializer default initializer passed to get_variable.
regularizer default regularizer passed to get_variable.
reuse Boolean, None, or tf.compat.v1.AUTO_REUSE, setting the reuse in get_variable. When eager execution is enabled this argument is always forced to be False.
caching_device string, callable, or None: the caching device passed to get_variable.
partitioner callable or None: the partitioner passed to get_variable.
custom_getter default custom getter passed to get_variable.
name_scope The name passed to tf.name_scope.
dtype default type passed to get_variable (defaults to DT_FLOAT).
use_resource if False, create a normal Variable; if True create an experimental ResourceVariable with well-defined semantics. Defaults to False (will later change to True). When eager execution is enabled this argument is always forced to be True.
constraint An optional projection function to be applied to the variable after being updated by an Optimizer (e.g. used to implement norm constraints or value constraints for layer weights). The function must take as input the unprojected Tensor representing the value of the variable and return the Tensor for the projected value (which must have the same shape). Constraints are not safe to use when doing asynchronous distributed training.



View source

Get this scope's variables.


View source

Gets an existing variable with this name or create a new one.


View source

Get this scope's global variables.


View source

Get this scope's local variables.


View source

Reuse variables in this scope.


View source

Set caching_device for this scope.


View source

Set custom getter for this scope.


View source

Set data type for this scope.


View source

Set initializer for this scope.


View source

Set partitioner for this scope.


View source

Set regularizer for this scope.


View source

Sets whether to use ResourceVariables for this scope.


View source

Get this scope's trainable variables.