tf_agents.keras_layers.RNNWrapper
Stay organized with collections
Save and categorize content based on your preferences.
Wraps a Keras RNN/LSTM/GRU layer to make network state more consistent.
tf_agents.keras_layers.RNNWrapper(
layer: tf.keras.layers.RNN, **kwargs
)
Args |
layer
|
An instance of tf.keras.layers.RNN or subclasses (including
tf.keras.layers.{LSTM,GRU,...} .
|
**kwargs
|
Extra args to Layer parent class.
|
Raises |
TypeError
|
If layer is not a subclass of tf.keras.layers.RNN .
|
NotImplementedError
|
If layer was created with return_state == False .
|
NotImplementederror
|
If layer was created with
return_sequences == False .
|
Attributes |
cell
|
Return the cell underlying the RNN layer.
|
state_size
|
Return the state_size of the cell underlying the RNN layer.
|
wrapped_layer
|
Return the wrapped RNN layer.
|
Methods
get_initial_state
View source
get_initial_state(
inputs=None
)
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-04-26 UTC.
[null,null,["Last updated 2024-04-26 UTC."],[],[],null,["# tf_agents.keras_layers.RNNWrapper\n\n\u003cbr /\u003e\n\n|---------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/keras_layers/rnn_wrapper.py#L29-L198) |\n\nWraps a Keras RNN/LSTM/GRU layer to make network state more consistent.\n\n#### View aliases\n\n\n**Main aliases**\n\n[`tf_agents.keras_layers.rnn_wrapper.RNNWrapper`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/keras_layers/RNNWrapper)\n\n\u003cbr /\u003e\n\n tf_agents.keras_layers.RNNWrapper(\n layer: tf.keras.layers.RNN, **kwargs\n )\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `layer` | An instance of [`tf.keras.layers.RNN`](https://www.tensorflow.org/api_docs/python/tf/keras/layers/RNN) or subclasses (including `tf.keras.layers.{LSTM,GRU,...}`. |\n| `**kwargs` | Extra args to `Layer` parent class. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Raises ------ ||\n|-----------------------|--------------------------------------------------------------------------------------------------------------------------|\n| `TypeError` | If `layer` is not a subclass of [`tf.keras.layers.RNN`](https://www.tensorflow.org/api_docs/python/tf/keras/layers/RNN). |\n| `NotImplementedError` | If `layer` was created with `return_state == False`. |\n| `NotImplementederror` | If `layer` was created with `return_sequences == False`. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Attributes ---------- ||\n|-----------------|---------------------------------------------------------------|\n| `cell` | Return the `cell` underlying the RNN layer. |\n| `state_size` | Return the `state_size` of the cell underlying the RNN layer. |\n| `wrapped_layer` | Return the wrapped RNN layer. |\n\n\u003cbr /\u003e\n\nMethods\n-------\n\n### `get_initial_state`\n\n[View source](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/keras_layers/rnn_wrapper.py#L137-L148) \n\n get_initial_state(\n inputs=None\n )"]]