Retrieves CudnnRNN params in canonical form. It supports the projection in LSTM.

tf.raw_ops.CudnnRNNParamsToCanonicalV2( num_layers, num_units, input_size, params, num_params_weights, num_params_biases, rnn_mode='lstm', input_mode='linear_input', direction='unidirectional', dropout=0, seed=0, seed2=0, num_proj=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_weights: number of weight parameter matrix for all layers. num_params_biases: number of bias parameter vector for all layers. 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. num_proj: The output dimensionality for the projection matrices. If None or 0, no projection is performed.

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: `half` , `float32` , `float64` . |

`num_params_weights` | An `int` that is `>= 1` . |

`num_params_biases` | 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` . |

`num_proj` | 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_weights` `Tensor` objects with the same type as `params` . |

`biases` | A list of `num_params_biases` `Tensor` objects with the same type as `params` . |

© 2020 The TensorFlow Authors. All rights reserved.

Licensed under the Creative Commons Attribution License 3.0.

Code samples licensed under the Apache 2.0 License.

https://www.tensorflow.org/versions/r2.4/api_docs/python/tf/raw_ops/CudnnRNNParamsToCanonicalV2