Not compatible with eager execution and tf.function. In particular, Graph
collections are deprecated in TF2. Instead please create a
tf.Module
container for all your model state, including variables.
You can then list all the variables in your tf.Module through the
variables attribute.
Global variables are variables that are shared across machines in a
distributed environment. The Variable() constructor or get_variable()
automatically adds new variables to the graph collection
GraphKeys.GLOBAL_VARIABLES.
This convenience function returns the contents of that collection.
(Optional.) A string. If supplied, the resulting list is filtered to
include only items whose name attribute matches scope using
re.match. Items without a name attribute are never returned if a scope
is supplied. The choice of re.match means that a scope without special
tokens filters by prefix.
[null,null,["Last updated 2024-04-26 UTC."],[],[],null,["# tf.compat.v1.global_variables\n\n\u003cbr /\u003e\n\n|-------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.16.1/tensorflow/python/ops/variables.py#L1701-L1733) |\n\nReturns global variables. \n\n tf.compat.v1.global_variables(\n scope=None\n )\n\n\u003cbr /\u003e\n\nMigrate to TF2\n--------------\n\n\u003cbr /\u003e\n\n| **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](https://www.tensorflow.org/guide/migrate) for instructions on how to migrate the rest of your code.\n\nNot compatible with eager execution and [`tf.function`](../../../tf/function). In particular, Graph\ncollections are deprecated in TF2. Instead please create a\n[tf.Module](https://www.tensorflow.org/guide/intro_to_modules)\ncontainer for all your model state, including variables.\nYou can then list all the variables in your [`tf.Module`](../../../tf/Module) through the\n`variables` attribute.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nDescription\n-----------\n\n### Used in the notebooks\n\n| Used in the guide |\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| - [Validating correctness \\& numerical equivalence](https://www.tensorflow.org/guide/migrate/validate_correctness) - [Migrating model checkpoints](https://www.tensorflow.org/guide/migrate/migrating_checkpoints) |\n\nGlobal variables are variables that are shared across machines in a\ndistributed environment. The `Variable()` constructor or `get_variable()`\nautomatically adds new variables to the graph collection\n`GraphKeys.GLOBAL_VARIABLES`.\nThis convenience function returns the contents of that collection.\n\nAn alternative to global variables are local variables. See\n[`tf.compat.v1.local_variables`](../../../tf/compat/v1/local_variables)\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `scope` | (Optional.) A string. If supplied, the resulting list is filtered to include only items whose `name` attribute matches `scope` using `re.match`. Items without a `name` attribute are never returned if a scope is supplied. The choice of `re.match` means that a `scope` without special tokens filters by prefix. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A list of `Variable` objects. ||\n\n\u003cbr /\u003e"]]