W3cubDocs

/TensorFlow Python

tf.VariableScope

class tf.VariableScope

See the guide: Variables > Sharing Variables

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_variable.
  • initializer: default initializer passed to get_variable.
  • regularizer: default regularizer passed to get_variable.
  • reuse: Boolean or None, setting the reuse in get_variable.
  • 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).

Properties

caching_device

custom_getter

dtype

initializer

name

original_name_scope

partitioner

regularizer

reuse

Methods

__init__(reuse, name='', initializer=None, regularizer=None, caching_device=None, partitioner=None, custom_getter=None, name_scope='', dtype=tf.float32)

Creates a new VariableScope with the given properties.

get_variable(var_store, name, shape=None, dtype=None, initializer=None, regularizer=None, trainable=True, collections=None, caching_device=None, partitioner=None, validate_shape=True, custom_getter=None)

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

reuse_variables()

Reuse variables in this scope.

set_caching_device(caching_device)

Set caching_device for this scope.

set_custom_getter(custom_getter)

Set custom getter for this scope.

set_dtype(dtype)

Set data type for this scope.

set_initializer(initializer)

Set initializer for this scope.

set_partitioner(partitioner)

Set partitioner for this scope.

set_regularizer(regularizer)

Set regularizer for this scope.

Defined in tensorflow/python/ops/variable_scope.py.

© 2017 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/VariableScope