tf.contrib.eager.EagerVariableStore
Stay organized with collections
Save and categorize content based on your preferences.
Wrapper allowing functional layers to be used with eager execution.
tf.contrib.eager.EagerVariableStore(
store=None
)
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.compat.v1.layers.dense(input, name="l1")
print(container.variables) # Should print the variables used in the layer.
Methods
as_default
View source
as_default()
copy
View source
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
View source
non_trainable_variables()
trainable_variables
View source
trainable_variables()
variables
View source
variables()
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-10-01 UTC.
[null,null,["Last updated 2020-10-01 UTC."],[],[],null,["# tf.contrib.eager.EagerVariableStore\n\n\u003cbr /\u003e\n\n|------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/ops/variable_scope.py#L1387-L1461) |\n\nWrapper allowing functional layers to be used with eager execution. \n\n tf.contrib.eager.EagerVariableStore(\n store=None\n )\n\nWhen eager execution is enabled Variables get deleted when they go out of\nscope, and are not stored in global collections by default. A lot of code\n(mostly the functional layers in tf.layers) assumes that variables are kept in\na global list.\n\nEagerVariableStore can be used in conjunction with this code to make it\neager-friendly. For example, to create a dense layer, use: \n\n container = tfe.EagerVariableStore()\n for input in dataset_iterator:\n with container.as_default():\n x = tf.compat.v1.layers.dense(input, name=\"l1\")\n print(container.variables) # Should print the variables used in the layer.\n\nMethods\n-------\n\n### `as_default`\n\n[View source](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/ops/variable_scope.py#L1418-L1419) \n\n as_default()\n\n### `copy`\n\n[View source](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/ops/variable_scope.py#L1436-L1461) \n\n copy()\n\nCopy this variable store and all of its contents.\n\nVariables contained in this store will be copied over to the new variable\nstore, meaning that they can be modified without affecting the variables in\nthis store.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|---|---|\n| A new EagerVariableStore instance containing copied variables. ||\n\n\u003cbr /\u003e\n\n### `non_trainable_variables`\n\n[View source](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/ops/variable_scope.py#L1430-L1433) \n\n non_trainable_variables()\n\n### `trainable_variables`\n\n[View source](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/ops/variable_scope.py#L1424-L1427) \n\n trainable_variables()\n\n### `variables`\n\n[View source](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/ops/variable_scope.py#L1421-L1422) \n\n variables()"]]