This object represents a parameter of a tf.keras.layer.Layer object which
isn't directly stored in a tf.Variable, but can be represented as a function
(of any number of tf.Variable attributes).
Attributes
name
Returns the name of this module as passed or determined in the ctor.
[[["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,["# tfc.layers.Parameter\n\n\u003cbr /\u003e\n\n|--------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/compression/blob/v2.14.1/tensorflow_compression/python/layers/parameters.py#L30-L55) |\n\nReparameterized `Layer` variable.\n\n#### View aliases\n\n\n**Main aliases**\n\n[`tfc.Parameter`](https://www.tensorflow.org/api_docs/python/tfc/layers/Parameter)\n\n\u003cbr /\u003e\n\n tfc.layers.Parameter(\n name=None\n )\n\nThis object represents a parameter of a `tf.keras.layer.Layer` object which\nisn't directly stored in a [`tf.Variable`](https://www.tensorflow.org/api_docs/python/tf/Variable), but can be represented as a function\n(of any number of [`tf.Variable`](https://www.tensorflow.org/api_docs/python/tf/Variable) attributes).\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Attributes ---------- ||\n|---------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `name` | Returns the name of this module as passed or determined in the ctor. \u003cbr /\u003e | **Note:** This is not the same as the `self.name_scope.name` which includes parent module names. |\n| `name_scope` | Returns a [`tf.name_scope`](https://www.tensorflow.org/api_docs/python/tf/name_scope) instance for this class. |\n| `non_trainable_variables` | Sequence of non-trainable variables owned by this module and its submodules.**Note:** this method uses reflection to find variables on the current instance and submodules. For performance reasons you may wish to cache the result of calling this method if you don't expect the return value to change. |\n| `submodules` | Sequence of all sub-modules. Submodules are modules which are properties of this module, or found as properties of modules which are properties of this module (and so on). a = tf.Module() b = tf.Module() c = tf.Module() a.b = b b.c = c list(a.submodules) == [b, c] True list(b.submodules) == [c] True list(c.submodules) == [] True \u003cbr /\u003e |\n| `trainable_variables` | Sequence of trainable variables owned by this module and its submodules. \u003cbr /\u003e | **Note:** this method uses reflection to find variables on the current instance and submodules. For performance reasons you may wish to cache the result of calling this method if you don't expect the return value to change. |\n| `variables` | Sequence of variables owned by this module and its submodules.**Note:** this method uses reflection to find variables on the current instance and submodules. For performance reasons you may wish to cache the result of calling this method if you don't expect the return value to change. |\n\nMethods\n-------\n\n### `get_config`\n\n[View source](https://github.com/tensorflow/compression/blob/v2.14.1/tensorflow_compression/python/layers/parameters.py#L42-L45) \n\n @abc.abstractmethod\n get_config()\n\nReturns the configuration of the `Parameter`.\n\n### `get_weights`\n\n[View source](https://github.com/tensorflow/compression/blob/v2.14.1/tensorflow_compression/python/layers/parameters.py#L47-L48) \n\n get_weights()\n\n### `set_weights`\n\n[View source](https://github.com/tensorflow/compression/blob/v2.14.1/tensorflow_compression/python/layers/parameters.py#L50-L55) \n\n set_weights(\n weights\n )\n\n### `with_name_scope`\n\n @classmethod\n with_name_scope(\n method\n )\n\nDecorator to automatically enter the module name scope. \n\n class MyModule(tf.Module):\n @tf.Module.with_name_scope\n def __call__(self, x):\n if not hasattr(self, 'w'):\n self.w = tf.Variable(tf.random.normal([x.shape[1], 3]))\n return tf.matmul(x, self.w)\n\nUsing the above module would produce [`tf.Variable`](https://www.tensorflow.org/api_docs/python/tf/Variable)s and [`tf.Tensor`](https://www.tensorflow.org/api_docs/python/tf/Tensor)s whose\nnames included the module name: \n\n mod = MyModule()\n mod(tf.ones([1, 2]))\n \u003ctf.Tensor: shape=(1, 3), dtype=float32, numpy=..., dtype=float32)\u003e\n mod.w\n \u003ctf.Variable 'my_module/Variable:0' shape=(2, 3) dtype=float32,\n numpy=..., dtype=float32)\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|----------|---------------------|\n| `method` | The method to wrap. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|---|---|\n| The original method wrapped such that it enters the module's name scope. ||\n\n\u003cbr /\u003e\n\n### `__call__`\n\n[View source](https://github.com/tensorflow/compression/blob/v2.14.1/tensorflow_compression/python/layers/parameters.py#L38-L40) \n\n @abc.abstractmethod\n __call__(\n compute_dtype=None\n )\n\nComputes and returns the parameter value as a [`tf.Tensor`](https://www.tensorflow.org/api_docs/python/tf/Tensor)."]]