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.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
{"lastModified": "Last updated 2023-10-06 UTC."}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-10-06 UTC."],[],[]]