Returns all variables created with trainable=True.
tf.compat.v1.trainable_variables(scope=None)
Migrate to TF2
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 trainable variables in your tf.Module through the
trainable_variables attribute.
Description
When passed trainable=True, the Variable() constructor automatically
adds new variables to the graph collection
GraphKeys.TRAINABLE_VARIABLES. This convenience function returns the
contents of that collection.
Args
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.
[[["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 2024-04-26 UTC."],[],[],null,["# tf.compat.v1.trainable_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#L1806-L1833) |\n\nReturns all variables created with `trainable=True`. \n\n tf.compat.v1.trainable_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 [`tf.Module`](../../../tf/Module)\ncontainer for all your model state, including variables.\nYou can then list all the trainable variables in your [`tf.Module`](../../../tf/Module) through the\n`trainable_variables` attribute.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nDescription\n-----------\n\nWhen passed `trainable=True`, the `Variable()` constructor automatically\nadds new variables to the graph collection\n`GraphKeys.TRAINABLE_VARIABLES`. This convenience function returns the\ncontents of that collection.\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"]]