tfl.lattice_layer.RandomMonotonicInitializer
Stay organized with collections
Save and categorize content based on your preferences.
Initializes a tfl.layers.Lattice
as uniform random monotonic function.
tfl.lattice_layer.RandomMonotonicInitializer(
lattice_sizes, output_min, output_max, unimodalities=None
)
- The uniform random monotonic function will initilaize the lattice parameters
uniformly at random and make it such that the parameters are monotonically
increasing for each input.
- The random parameters will be sampled from
[output_min, output_max]
Args |
lattice_sizes
|
Lattice sizes of tfl.layers.Lattice to initialize.
|
output_min
|
Minimum layer output after initialization.
|
output_max
|
Maximum layer output after initialization.
|
unimodalities
|
None or unimodal dimensions after initialization. Does not
need to match unimodalities of tfl.layers.Lattice .
|
Raises |
ValueError
|
If there are invalid hyperparameters.
|
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 serialization.
__call__
View source
__call__(
shape, dtype=None, partition_info=None
)
Returns weights of tfl.layers.Lattice
layer.
Args |
shape
|
Must be: (prod(lattice_sizes), units) .
|
dtype
|
Standard Keras initializer param.
|
partition_info
|
Standard Keras initializer param. Not used.
|
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.lattice_layer.RandomMonotonicInitializer\n\n\u003cbr /\u003e\n\n|---------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/lattice/blob/v2.1.1/tensorflow_lattice/python/lattice_layer.py#L740-L802) |\n\nInitializes a [`tfl.layers.Lattice`](../../tfl/layers/Lattice) as uniform random monotonic function. \n\n tfl.lattice_layer.RandomMonotonicInitializer(\n lattice_sizes, output_min, output_max, unimodalities=None\n )\n\n- The uniform random monotonic function will initilaize the lattice parameters uniformly at random and make it such that the parameters are monotonically increasing for each input.\n- The random parameters will be sampled from `[output_min, output_max]`\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|-----------------|-----------------------------------------------------------------------------------------------------------------------------------------------|\n| `lattice_sizes` | Lattice sizes of [`tfl.layers.Lattice`](../../tfl/layers/Lattice) to initialize. |\n| `output_min` | Minimum layer output after initialization. |\n| `output_max` | Maximum layer output after initialization. |\n| `unimodalities` | None or unimodal dimensions after initialization. Does not need to match `unimodalities` of [`tfl.layers.Lattice`](../../tfl/layers/Lattice). |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Raises ------ ||\n|--------------|---------------------------------------|\n| `ValueError` | If there are invalid hyperparameters. |\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/lattice_layer.py#L794-L802) \n\n get_config()\n\nStandard Keras config for serialization.\n\n### `__call__`\n\n[View source](https://github.com/tensorflow/lattice/blob/v2.1.1/tensorflow_lattice/python/lattice_layer.py#L778-L792) \n\n __call__(\n shape, dtype=None, partition_info=None\n )\n\nReturns weights of [`tfl.layers.Lattice`](../../tfl/layers/Lattice) layer.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|------------------|---------------------------------------------|\n| `shape` | Must be: `(prod(lattice_sizes), units)`. |\n| `dtype` | Standard Keras initializer param. |\n| `partition_info` | Standard Keras initializer param. Not used. |\n\n\u003cbr /\u003e"]]