tf.raw_ops.CudnnRNNParamsToCanonical
Stay organized with collections
Save and categorize content based on your preferences.
Retrieves CudnnRNN params in canonical form.
tf.raw_ops.CudnnRNNParamsToCanonical(
num_layers,
num_units,
input_size,
params,
num_params,
rnn_mode='lstm',
input_mode='linear_input',
direction='unidirectional',
dropout=0,
seed=0,
seed2=0,
name=None
)
Retrieves a set of weights from the opaque params buffer that can be saved and
restored in a way compatible with future runs.
Note that the params buffer may not be compatible across different GPUs. So any
save and restoration should be converted to and from the canonical weights and
biases.
num_layers: Specifies the number of layers in the RNN model.
num_units: Specifies the size of the hidden state.
input_size: Specifies the size of the input state.
num_params: number of parameter sets for all layers.
Each layer may contain multiple parameter sets, with each set consisting of
a weight matrix and a bias vector.
weights: the canonical form of weights that can be used for saving
and restoration. They are more likely to be compatible across different
generations.
biases: the canonical form of biases that can be used for saving
and restoration. They are more likely to be compatible across different
generations.
rnn_mode: Indicates the type of the RNN model.
input_mode: Indicate whether there is a linear projection between the input and
The actual computation before the first layer. 'skip_input' is only allowed
when input_size == num_units; 'auto_select' implies 'skip_input' when
input_size == num_units; otherwise, it implies 'linear_input'.
direction: Indicates whether a bidirectional model will be used.
dir = (direction == bidirectional) ? 2 : 1
dropout: dropout probability. When set to 0., dropout is disabled.
seed: the 1st part of a seed to initialize dropout.
seed2: the 2nd part of a seed to initialize dropout.
Args |
num_layers
|
A Tensor of type int32 .
|
num_units
|
A Tensor of type int32 .
|
input_size
|
A Tensor of type int32 .
|
params
|
A Tensor . Must be one of the following types: bfloat16 , half , float32 , float64 .
|
num_params
|
An int that is >= 1 .
|
rnn_mode
|
An optional string from: "rnn_relu", "rnn_tanh", "lstm", "gru" . Defaults to "lstm" .
|
input_mode
|
An optional string from: "linear_input", "skip_input", "auto_select" . Defaults to "linear_input" .
|
direction
|
An optional string from: "unidirectional", "bidirectional" . Defaults to "unidirectional" .
|
dropout
|
An optional float . Defaults to 0 .
|
seed
|
An optional int . Defaults to 0 .
|
seed2
|
An optional int . Defaults to 0 .
|
name
|
A name for the operation (optional).
|
Returns |
A tuple of Tensor objects (weights, biases).
|
weights
|
A list of num_params Tensor objects with the same type as params .
|
biases
|
A list of num_params Tensor objects with the same type as params .
|
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. Some content is licensed under the numpy license.
Last updated 2023-10-06 UTC.
[null,null,["Last updated 2023-10-06 UTC."],[],[],null,["# tf.raw_ops.CudnnRNNParamsToCanonical\n\n\u003cbr /\u003e\n\nRetrieves CudnnRNN params in canonical form.\n\n#### View aliases\n\n\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.raw_ops.CudnnRNNParamsToCanonical`](https://www.tensorflow.org/api_docs/python/tf/raw_ops/CudnnRNNParamsToCanonical)\n\n\u003cbr /\u003e\n\n tf.raw_ops.CudnnRNNParamsToCanonical(\n num_layers,\n num_units,\n input_size,\n params,\n num_params,\n rnn_mode='lstm',\n input_mode='linear_input',\n direction='unidirectional',\n dropout=0,\n seed=0,\n seed2=0,\n name=None\n )\n\nRetrieves a set of weights from the opaque params buffer that can be saved and\nrestored in a way compatible with future runs.\n\nNote that the params buffer may not be compatible across different GPUs. So any\nsave and restoration should be converted to and from the canonical weights and\nbiases.\n\nnum_layers: Specifies the number of layers in the RNN model.\nnum_units: Specifies the size of the hidden state.\ninput_size: Specifies the size of the input state.\nnum_params: number of parameter sets for all layers.\nEach layer may contain multiple parameter sets, with each set consisting of\na weight matrix and a bias vector.\nweights: the canonical form of weights that can be used for saving\nand restoration. They are more likely to be compatible across different\ngenerations.\nbiases: the canonical form of biases that can be used for saving\nand restoration. They are more likely to be compatible across different\ngenerations.\nrnn_mode: Indicates the type of the RNN model.\ninput_mode: Indicate whether there is a linear projection between the input and\nThe actual computation before the first layer. 'skip_input' is only allowed\nwhen input_size == num_units; 'auto_select' implies 'skip_input' when\ninput_size == num_units; otherwise, it implies 'linear_input'.\ndirection: Indicates whether a bidirectional model will be used.\ndir = (direction == bidirectional) ? 2 : 1\ndropout: dropout probability. When set to 0., dropout is disabled.\nseed: the 1st part of a seed to initialize dropout.\nseed2: the 2nd part of a seed to initialize dropout.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|--------------|---------------------------------------------------------------------------------------------------------|\n| `num_layers` | A `Tensor` of type `int32`. |\n| `num_units` | A `Tensor` of type `int32`. |\n| `input_size` | A `Tensor` of type `int32`. |\n| `params` | A `Tensor`. Must be one of the following types: `bfloat16`, `half`, `float32`, `float64`. |\n| `num_params` | An `int` that is `\u003e= 1`. |\n| `rnn_mode` | An optional `string` from: `\"rnn_relu\", \"rnn_tanh\", \"lstm\", \"gru\"`. Defaults to `\"lstm\"`. |\n| `input_mode` | An optional `string` from: `\"linear_input\", \"skip_input\", \"auto_select\"`. Defaults to `\"linear_input\"`. |\n| `direction` | An optional `string` from: `\"unidirectional\", \"bidirectional\"`. Defaults to `\"unidirectional\"`. |\n| `dropout` | An optional `float`. Defaults to `0`. |\n| `seed` | An optional `int`. Defaults to `0`. |\n| `seed2` | An optional `int`. Defaults to `0`. |\n| `name` | A name for the operation (optional). |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|-----------|-------------------------------------------------------------------------|\n| A tuple of `Tensor` objects (weights, biases). ||\n| `weights` | A list of `num_params` `Tensor` objects with the same type as `params`. |\n| `biases` | A list of `num_params` `Tensor` objects with the same type as `params`. |\n\n\u003cbr /\u003e"]]