# Module: tf.contrib.rnn

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/contrib/rnn/__init__.py) |

RNN Cells and additional RNN operations.

## Classes

[`class AttentionCellWrapper`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/rnn/AttentionCellWrapper): Basic attention cell wrapper.

[`class BasicLSTMCell`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/nn/rnn_cell/BasicLSTMCell): DEPRECATED: Please use [`tf.compat.v1.nn.rnn_cell.LSTMCell`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/nn/rnn_cell/LSTMCell) instead.

[`class BasicRNNCell`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/nn/rnn_cell/BasicRNNCell): The most basic RNN cell.

[`class BidirectionalGridLSTMCell`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/rnn/BidirectionalGridLSTMCell): Bidirectional GridLstm cell.

[`class CompiledWrapper`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/rnn/CompiledWrapper): Wraps step execution in an XLA JIT scope.

[`class Conv1DLSTMCell`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/rnn/Conv1DLSTMCell): 1D Convolutional LSTM recurrent network cell.

[`class Conv2DLSTMCell`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/rnn/Conv2DLSTMCell): 2D Convolutional LSTM recurrent network cell.

[`class Conv3DLSTMCell`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/rnn/Conv3DLSTMCell): 3D Convolutional LSTM recurrent network cell.

[`class ConvLSTMCell`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/rnn/ConvLSTMCell): Convolutional LSTM recurrent network cell.

[`class CoupledInputForgetGateLSTMCell`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/rnn/CoupledInputForgetGateLSTMCell): Long short-term memory unit (LSTM) recurrent network cell.

[`class DeviceWrapper`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/nn/rnn_cell/DeviceWrapper): Operator that ensures an RNNCell runs on a particular device.

[`class DropoutWrapper`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/nn/rnn_cell/DropoutWrapper): Operator adding dropout to inputs and outputs of the given cell.

[`class EmbeddingWrapper`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/rnn/EmbeddingWrapper): Operator adding input embedding to the given cell.

[`class FusedRNNCell`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/rnn/FusedRNNCell): Abstract object representing a fused RNN cell.

[`class FusedRNNCellAdaptor`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/rnn/FusedRNNCellAdaptor): This is an adaptor for RNNCell classes to be used with `FusedRNNCell`.

[`class GLSTMCell`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/rnn/GLSTMCell): Group LSTM cell (G-LSTM).

[`class GRUBlockCell`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/rnn/GRUBlockCell): Block GRU cell implementation.

[`class GRUBlockCellV2`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/rnn/GRUBlockCellV2): Temporary GRUBlockCell impl with a different variable naming scheme.

[`class GRUCell`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/nn/rnn_cell/GRUCell): Gated Recurrent Unit cell (cf.

[`class GridLSTMCell`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/rnn/GridLSTMCell): Grid Long short-term memory unit (LSTM) recurrent network cell.

[`class HighwayWrapper`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/rnn/HighwayWrapper): RNNCell wrapper that adds highway connection on cell input and output.

[`class IndRNNCell`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/rnn/IndRNNCell): Independently Recurrent Neural Network (IndRNN) cell

[`class IndyGRUCell`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/rnn/IndyGRUCell): Independently Gated Recurrent Unit cell.

[`class IndyLSTMCell`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/rnn/IndyLSTMCell): Basic IndyLSTM recurrent network cell.

[`class InputProjectionWrapper`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/rnn/InputProjectionWrapper): Operator adding an input projection to the given cell.

[`class IntersectionRNNCell`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/rnn/IntersectionRNNCell): Intersection Recurrent Neural Network (+RNN) cell.

[`class LSTMBlockCell`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/rnn/LSTMBlockCell): Basic LSTM recurrent network cell.

[`class LSTMBlockFusedCell`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/rnn/LSTMBlockFusedCell): FusedRNNCell implementation of LSTM.

[`class LSTMBlockWrapper`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/rnn/LSTMBlockWrapper): This is a helper class that provides housekeeping for LSTM cells.

[`class LSTMCell`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/nn/rnn_cell/LSTMCell): Long short-term memory unit (LSTM) recurrent network cell.

[`class LSTMStateTuple`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/nn/rnn_cell/LSTMStateTuple): Tuple used by LSTM Cells for `state_size`, `zero_state`, and output state.

[`class LayerNormBasicLSTMCell`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/rnn/LayerNormBasicLSTMCell): LSTM unit with layer normalization and recurrent dropout.

[`class LayerRNNCell`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/rnn/LayerRNNCell): Subclass of RNNCells that act like proper `tf.Layer` objects.

[`class MultiRNNCell`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/nn/rnn_cell/MultiRNNCell): RNN cell composed sequentially of multiple simple cells.

[`class NASCell`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/rnn/NASCell): Neural Architecture Search (NAS) recurrent network cell.

[`class OutputProjectionWrapper`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/rnn/OutputProjectionWrapper): Operator adding an output projection to the given cell.

[`class PhasedLSTMCell`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/rnn/PhasedLSTMCell): Phased LSTM recurrent network cell.

[`class RNNCell`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/nn/rnn_cell/RNNCell): Abstract object representing an RNN cell.

[`class ResidualWrapper`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/nn/rnn_cell/ResidualWrapper): RNNCell wrapper that ensures cell inputs are added to the outputs.

[`class SRUCell`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/rnn/SRUCell): SRU, Simple Recurrent Unit.

[`class TimeFreqLSTMCell`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/rnn/TimeFreqLSTMCell): Time-Frequency Long short-term memory unit (LSTM) recurrent network cell.

[`class TimeReversedFusedRNN`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/rnn/TimeReversedFusedRNN): This is an adaptor to time-reverse a FusedRNNCell.

[`class UGRNNCell`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/rnn/UGRNNCell): Update Gate Recurrent Neural Network (UGRNN) cell.

## Functions

[`best_effort_input_batch_size(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/rnn/best_effort_input_batch_size): Get static input batch size if available, with fallback to the dynamic one.

[`stack_bidirectional_dynamic_rnn(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/rnn/stack_bidirectional_dynamic_rnn): Creates a dynamic bidirectional recurrent neural network.

[`stack_bidirectional_rnn(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/rnn/stack_bidirectional_rnn): Creates a bidirectional recurrent neural network.

[`static_bidirectional_rnn(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/nn/static_bidirectional_rnn): Creates a bidirectional recurrent neural network. (deprecated)

[`static_rnn(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/nn/static_rnn): Creates a recurrent neural network specified by RNNCell `cell`. (deprecated)

[`static_state_saving_rnn(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/nn/static_state_saving_rnn): RNN that accepts a state saver for time-truncated RNN calculation. (deprecated)

[`transpose_batch_time(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/rnn/transpose_batch_time): Transposes the batch and time dimensions of a Tensor.