tf.compat.v1.get_variable_scope
Stay organized with collections
Save and categorize content based on your preferences.
Returns the current variable scope.
tf . compat . v1 . get_variable_scope ()
Caution: This API was designed for TensorFlow v1.
Continue reading for details on how to migrate from this API to a native
TensorFlow v2 equivalent. See the
TensorFlow v1 to TensorFlow v2 migration guide
for instructions on how to migrate the rest of your code.
Although it is a legacy compat.v1
api,
tf.compat.v1.get_variable
is compatible with eager
execution and tf.function
However, to maintain variable-scope based variable reuse
you will need to combine it with
tf.compat.v1.keras.utils.track_tf1_style_variables
. (Though
it will behave as if reuse is always set to tf.compat.v1.AUTO_REUSE
.)
See the
migration guide
for more info.
The TF2 equivalent, if you are just trying to track
variable name prefixes and not control get_variable
-based variable reuse,
would be to use tf.name_scope
and capture the output of opening the
scope (which represents the current name prefix).
For example:
x = tf . name_scope ( 'foo' ) as current_scope :
...
Description
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. Some content is licensed under the numpy license .
Last updated 2023-10-06 UTC.
[null,null,["Last updated 2023-10-06 UTC."],[],[],null,[]]