tf.keras.layers.StackedRNNCells
Stay organized with collections
Save and categorize content based on your preferences.
Wrapper allowing a stack of RNN cells to behave as a single cell.
Inherits From: Layer
tf.keras.layers.StackedRNNCells(
cells, **kwargs
)
Used to implement efficient stacked RNNs.
Arguments |
cells
|
List of RNN cell instances.
|
Examples:
cells = [
keras.layers.LSTMCell(output_dim),
keras.layers.LSTMCell(output_dim),
keras.layers.LSTMCell(output_dim),
]
inputs = keras.Input((timesteps, input_dim))
x = keras.layers.RNN(cells)(inputs)
Attributes |
output_size
|
|
state_size
|
|
Methods
get_initial_state
View source
get_initial_state(
inputs=None, batch_size=None, dtype=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 2020-10-01 UTC.
[null,null,["Last updated 2020-10-01 UTC."],[],[],null,["# tf.keras.layers.StackedRNNCells\n\n\u003cbr /\u003e\n\n|--------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------|\n| [TensorFlow 2 version](/api_docs/python/tf/keras/layers/StackedRNNCells) | [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/keras/layers/recurrent.py#L49-L179) |\n\nWrapper allowing a stack of RNN cells to behave as a single cell.\n\nInherits From: [`Layer`](../../../tf/keras/layers/Layer)\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.keras.layers.StackedRNNCells`](/api_docs/python/tf/keras/layers/StackedRNNCells), \\`tf.compat.v2.keras.layers.StackedRNNCells\\`\n\n\u003cbr /\u003e\n\n tf.keras.layers.StackedRNNCells(\n cells, **kwargs\n )\n\nUsed to implement efficient stacked RNNs.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Arguments --------- ||\n|---------|-----------------------------|\n| `cells` | List of RNN cell instances. |\n\n\u003cbr /\u003e\n\n#### Examples:\n\n cells = [\n keras.layers.LSTMCell(output_dim),\n keras.layers.LSTMCell(output_dim),\n keras.layers.LSTMCell(output_dim),\n ]\n\n inputs = keras.Input((timesteps, input_dim))\n x = keras.layers.RNN(cells)(inputs)\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Attributes ---------- ||\n|---------------|---------------|\n| `output_size` | \u003cbr /\u003e \u003cbr /\u003e |\n| `state_size` | \u003cbr /\u003e \u003cbr /\u003e |\n\n\u003cbr /\u003e\n\nMethods\n-------\n\n### `get_initial_state`\n\n[View source](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/keras/layers/recurrent.py#L107-L118) \n\n get_initial_state(\n inputs=None, batch_size=None, dtype=None\n )"]]