# RNN Cell wrappers (RNNCells that wrap other RNNCells)

### class tf.nn.rnn_cell.MultiRNNCell

RNN cell composed sequentially of multiple simple cells.

#### tf.nn.rnn_cell.MultiRNNCell.__call__(inputs, state, scope=None) {:#MultiRNNCell.call}

Run this multi-layer cell on inputs, starting from state.

#### tf.nn.rnn_cell.MultiRNNCell.__init__(cells, state_is_tuple=True) {:#MultiRNNCell.init}

Create a RNN cell composed sequentially of a number of RNNCells.

##### Args:
• cells: list of RNNCells that will be composed in this order.
• state_is_tuple: If True, accepted and returned states are n-tuples, where n = len(cells). If False, the states are all concatenated along the column axis. This latter behavior will soon be deprecated.
##### Raises:
• ValueError: if cells is empty (not allowed), or at least one of the cells returns a state tuple but the flag state_is_tuple is False.

#### tf.nn.rnn_cell.MultiRNNCell.zero_state(batch_size, dtype)

Return zero-filled state tensor(s).

##### Args:
• batch_size: int, float, or unit Tensor representing the batch size.
• dtype: the data type to use for the state.
##### Returns:

If state_size is an int or TensorShape, then the return value is a N-D tensor of shape [batch_size x state_size] filled with zeros.

If state_size is a nested list or tuple, then the return value is a nested list or tuple (of the same structure) of 2-D tensors with the shapes [batch_size x s] for each s in state_size.

### class tf.nn.rnn_cell.DropoutWrapper

Operator adding dropout to inputs and outputs of the given cell.

#### tf.nn.rnn_cell.DropoutWrapper.__call__(inputs, state, scope=None) {:#DropoutWrapper.call}

Run the cell with the declared dropouts.

#### tf.nn.rnn_cell.DropoutWrapper.__init__(cell, input_keep_prob=1.0, output_keep_prob=1.0, seed=None) {:#DropoutWrapper.init}

Create a cell with added input and/or output dropout.

Dropout is never used on the state.

##### Args:
• cell: an RNNCell, a projection to output_size is added to it.
• input_keep_prob: unit Tensor or float between 0 and 1, input keep probability; if it is float and 1, no input dropout will be added.
• output_keep_prob: unit Tensor or float between 0 and 1, output keep probability; if it is float and 1, no output dropout will be added.
• seed: (optional) integer, the randomness seed.
##### Raises:
• TypeError: if cell is not an RNNCell.
• ValueError: if keep_prob is not between 0 and 1.

#### tf.nn.rnn_cell.DropoutWrapper.zero_state(batch_size, dtype)

Return zero-filled state tensor(s).

##### Args:
• batch_size: int, float, or unit Tensor representing the batch size.
• dtype: the data type to use for the state.
##### Returns:

If state_size is an int or TensorShape, then the return value is a N-D tensor of shape [batch_size x state_size] filled with zeros.

If state_size is a nested list or tuple, then the return value is a nested list or tuple (of the same structure) of 2-D tensors with the shapes [batch_size x s] for each s in state_size.

### class tf.nn.rnn_cell.EmbeddingWrapper

Operator adding input embedding to the given cell.

#### tf.nn.rnn_cell.EmbeddingWrapper.__call__(inputs, state, scope=None) {:#EmbeddingWrapper.call}

Run the cell on embedded inputs.

#### tf.nn.rnn_cell.EmbeddingWrapper.__init__(cell, embedding_classes, embedding_size, initializer=None) {:#EmbeddingWrapper.init}

Create a cell with an added input embedding.

##### Args:
• cell: an RNNCell, an embedding will be put before its inputs.
• embedding_classes: integer, how many symbols will be embedded.
• embedding_size: integer, the size of the vectors we embed into.
• initializer: an initializer to use when creating the embedding; if None, the initializer from variable scope or a default one is used.
##### Raises:
• TypeError: if cell is not an RNNCell.
• ValueError: if embedding_classes is not positive.

#### tf.nn.rnn_cell.EmbeddingWrapper.zero_state(batch_size, dtype)

Return zero-filled state tensor(s).

##### Args:
• batch_size: int, float, or unit Tensor representing the batch size.
• dtype: the data type to use for the state.
##### Returns:

If state_size is an int or TensorShape, then the return value is a N-D tensor of shape [batch_size x state_size] filled with zeros.

If state_size is a nested list or tuple, then the return value is a nested list or tuple (of the same structure) of 2-D tensors with the shapes [batch_size x s] for each s in state_size.

### class tf.nn.rnn_cell.InputProjectionWrapper

Operator adding an input projection to the given cell.

#### tf.nn.rnn_cell.InputProjectionWrapper.__call__(inputs, state, scope=None) {:#InputProjectionWrapper.call}

Run the input projection and then the cell.

#### tf.nn.rnn_cell.InputProjectionWrapper.__init__(cell, num_proj, input_size=None) {:#InputProjectionWrapper.init}

Create a cell with input projection.

##### Args:
• cell: an RNNCell, a projection of inputs is added before it.
• num_proj: Python integer. The dimension to project to.
• input_size: Deprecated and unused.
##### Raises:
• TypeError: if cell is not an RNNCell.

#### tf.nn.rnn_cell.InputProjectionWrapper.zero_state(batch_size, dtype)

Return zero-filled state tensor(s).

##### Args:
• batch_size: int, float, or unit Tensor representing the batch size.
• dtype: the data type to use for the state.
##### Returns:

If state_size is an int or TensorShape, then the return value is a N-D tensor of shape [batch_size x state_size] filled with zeros.

If state_size is a nested list or tuple, then the return value is a nested list or tuple (of the same structure) of 2-D tensors with the shapes [batch_size x s] for each s in state_size.

### class tf.nn.rnn_cell.OutputProjectionWrapper

Operator adding an output projection to the given cell.

#### tf.nn.rnn_cell.OutputProjectionWrapper.__call__(inputs, state, scope=None) {:#OutputProjectionWrapper.call}

Run the cell and output projection on inputs, starting from state.

#### tf.nn.rnn_cell.OutputProjectionWrapper.__init__(cell, output_size) {:#OutputProjectionWrapper.init}

Create a cell with output projection.

##### Args:
• cell: an RNNCell, a projection to output_size is added to it.
• output_size: integer, the size of the output after projection.
##### Raises:
• TypeError: if cell is not an RNNCell.
• ValueError: if output_size is not positive.

#### tf.nn.rnn_cell.OutputProjectionWrapper.zero_state(batch_size, dtype)

Return zero-filled state tensor(s).

##### Args:
• batch_size: int, float, or unit Tensor representing the batch size.
• dtype: the data type to use for the state.
##### Returns:

If state_size is an int or TensorShape, then the return value is a N-D tensor of shape [batch_size x state_size] filled with zeros.

If state_size is a nested list or tuple, then the return value is a nested list or tuple (of the same structure) of 2-D tensors with the shapes [batch_size x s] for each s in state_size.