W3cubDocs

/TensorFlow Python

tf.contrib.eager.EagerVariableStore

Class EagerVariableStore

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

Wrapper allowing functional layers to be used with eager execution.

When eager execution is enabled Variables get deleted when they go out of scope, and are not stored in global collections by default. A lot of code (mostly the functional layers in tf.layers) assumes that variables are kept in a global list.

EagerVariableStore can be used in conjunction with this code to make it eager-friendly. For example, to create a dense layer, use:

container = tfe.EagerVariableStore()
for input in dataset_iterator:
  with container.as_default():
    x = tf.layers.dense(input, name="l1")
print(container.variables)  # Should print the variables used in the layer.

Methods

__init__

__init__(store=None)

Initialize self. See help(type(self)) for accurate signature.

as_default

as_default()

copy

copy()

Copy this variable store and all of its contents.

Variables contained in this store will be copied over to the new variable store, meaning that they can be modified without affecting the variables in this store.

Returns:

A new EagerVariableStore instance containing copied variables.

non_trainable_variables

non_trainable_variables()

trainable_variables

trainable_variables()

variables

variables()

© 2018 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/contrib/eager/EagerVariableStore