RNNCellWrapper

class opennmt.layers.RNNCellWrapper(*args, **kwargs)[source]

A wrapper for RNN cells.

Inherits from: opennmt.layers.LayerWrapper

__init__(cell, input_dropout=0, output_dropout=0, residual_connection=False, **kwargs)[source]

Initializes the wrapper.

Parameters
  • cell – The cell to wrap.

  • input_dropout – The probability to drop units in the cell input.

  • output_dropout – The probability to drop units in the cell output.

  • residual_connection – Add the inputs to cell outputs (if their shape are compatible).

  • kwargs – Additional layer arguments.

property state_size

The cell state size.

property output_size

The cell output size.

get_initial_state(inputs=None, batch_size=None, dtype=None)[source]

Returns the initial cell state.