make_rnn_cell

opennmt.layers.make_rnn_cell(num_layers, num_units, dropout=0, residual_connections=False, cell_class=None, **kwargs)[source]

Convenience function to build a multi-layer RNN cell.

Parameters
  • num_layers – The number of layers.

  • num_units – The number of units in each layer.

  • dropout – The probability to drop units in each layer output.

  • residual_connections – If True, each layer input will be added to its output.

  • cell_class – The inner cell class or a callable taking num_units as argument and returning a cell. Defaults to a LSTM cell.

  • kwargs – Additional arguments passed to the cell constructor.

Returns

A tf.keras.layers.StackedRNNCells instance.