tf.layers.experimental.set_keras_style
Stay organized with collections
Save and categorize content based on your preferences.
Use Keras-style variable management.
tf.layers.experimental.set_keras_style()
All tf.layers and tf RNN cells created after keras style ha been enabled
use Keras-style variable management. Creating such layers with a
scope= argument is disallowed, and reuse=True is disallowed.
The purpose of this function is to allow users of existing layers to
slowly transition to Keras layers API without breaking existing
functionality.
For more details, see the documentation for keras_style_scope
.
Note, once keras style has been set, it is set globally for the entire
program and cannot be unset.
Example:
set_keras_style()
model_1 = RNNModel(name="model_1")
model_2 = RNNModel(name="model_2")
# model_1 and model_2 are guaranteed to create their own variables.
output_1, next_state_1 = model_1(input, state)
output_2, next_state_2 = model_2(input, state)
assert len(model_1.weights) > 0
assert len(model_2.weights) > 0
assert(model_1.weights != model_2.weights)
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.layers.experimental.set_keras_style\n\n\u003cbr /\u003e\n\n|---------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/layers/base.py#L114-L149) |\n\nUse Keras-style variable management.\n\n#### View aliases\n\n\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.layers.experimental.set_keras_style`](/api_docs/python/tf/compat/v1/layers/experimental/set_keras_style)\n\n\u003cbr /\u003e\n\n tf.layers.experimental.set_keras_style()\n\nAll tf.layers and tf RNN cells created after keras style ha been enabled\nuse Keras-style variable management. Creating such layers with a\nscope= argument is disallowed, and reuse=True is disallowed.\n\nThe purpose of this function is to allow users of existing layers to\nslowly transition to Keras layers API without breaking existing\nfunctionality.\n\nFor more details, see the documentation for `keras_style_scope`.\n\nNote, once keras style has been set, it is set globally for the entire\nprogram and cannot be unset.\n\n#### Example:\n\n set_keras_style()\n\n model_1 = RNNModel(name=\"model_1\")\n model_2 = RNNModel(name=\"model_2\")\n\n # model_1 and model_2 are guaranteed to create their own variables.\n output_1, next_state_1 = model_1(input, state)\n output_2, next_state_2 = model_2(input, state)\n\n assert len(model_1.weights) \u003e 0\n assert len(model_2.weights) \u003e 0\n assert(model_1.weights != model_2.weights)"]]