tfl.kronecker_factored_lattice_layer.ScaleInitializer
Stay organized with collections
Save and categorize content based on your preferences.
Initializes scale depending on output_min and output_max.
tfl.kronecker_factored_lattice_layer.ScaleInitializer(
output_min, output_max
)
If both output_min and output_max are set, scale is initialized to half their
difference, alternating signs for each term. If only output_min is set, scale
is initialized to 1 for each term. If only output_max is set, scale is
initialized to -1 for each term. Otherwise scale is initialized to alternate
between 1 and -1 for each term.
Args |
output_min
|
None or minimum layer output.
|
output_max
|
None or maximum layer output.
|
Methods
from_config
@classmethod
from_config(
config
)
Instantiates an initializer from a configuration dictionary.
Example:
initializer = RandomUniform(-1, 1)
config = initializer.get_config()
initializer = RandomUniform.from_config(config)
Args |
config
|
A Python dictionary, the output of get_config() .
|
Returns |
An Initializer instance.
|
get_config
View source
get_config()
Standard Keras config for serializaion.
__call__
View source
__call__(
shape, dtype=None, **kwargs
)
Returns weights of tfl.layers.KroneckerFactoredLattice
scale.
Args |
shape
|
Must be: (units, num_terms) .
|
dtype
|
Standard Keras initializer param.
|
**kwargs
|
Other args passed to keras.initializers.Initializer call
method.
|
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.
Last updated 2024-08-02 UTC.
[null,null,["Last updated 2024-08-02 UTC."],[],[],null,["# tfl.kronecker_factored_lattice_layer.ScaleInitializer\n\n\u003cbr /\u003e\n\n|----------------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/lattice/blob/v2.1.1/tensorflow_lattice/python/kronecker_factored_lattice_layer.py#L500-L544) |\n\nInitializes scale depending on output_min and output_max. \n\n tfl.kronecker_factored_lattice_layer.ScaleInitializer(\n output_min, output_max\n )\n\nIf both output_min and output_max are set, scale is initialized to half their\ndifference, alternating signs for each term. If only output_min is set, scale\nis initialized to 1 for each term. If only output_max is set, scale is\ninitialized to -1 for each term. Otherwise scale is initialized to alternate\nbetween 1 and -1 for each term.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|--------------|-------------------------------|\n| `output_min` | None or minimum layer output. |\n| `output_max` | None or maximum layer output. |\n\n\u003cbr /\u003e\n\nMethods\n-------\n\n### `from_config`\n\n @classmethod\n from_config(\n config\n )\n\nInstantiates an initializer from a configuration dictionary.\n\n#### Example:\n\n initializer = RandomUniform(-1, 1)\n config = initializer.get_config()\n initializer = RandomUniform.from_config(config)\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|----------|----------------------------------------------------|\n| `config` | A Python dictionary, the output of `get_config()`. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|---|---|\n| An `Initializer` instance. ||\n\n\u003cbr /\u003e\n\n### `get_config`\n\n[View source](https://github.com/tensorflow/lattice/blob/v2.1.1/tensorflow_lattice/python/kronecker_factored_lattice_layer.py#L538-L544) \n\n get_config()\n\nStandard Keras config for serializaion.\n\n### `__call__`\n\n[View source](https://github.com/tensorflow/lattice/blob/v2.1.1/tensorflow_lattice/python/kronecker_factored_lattice_layer.py#L522-L536) \n\n __call__(\n shape, dtype=None, **kwargs\n )\n\nReturns weights of [`tfl.layers.KroneckerFactoredLattice`](../../tfl/layers/KroneckerFactoredLattice) scale.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|------------|-------------------------------------------------------------------------------------------------------------------------------------------|\n| `shape` | Must be: `(units, num_terms)`. |\n| `dtype` | Standard Keras initializer param. |\n| `**kwargs` | Other args passed to [`keras.initializers.Initializer`](https://www.tensorflow.org/api_docs/python/tf/keras/Initializer) **call** method. |\n\n\u003cbr /\u003e"]]