def build_unidirectional_rnn(sequences, length,
                             num_layers, num_residual_layers, num_units,
                             unit_type, forget_bias, dropout, mode,
                             trainable=True):
  """Builds sequences encoded with a unidirectional RNN."""
  cell = create_rnn_cell(
      unit_type=unit_type,
      num_units=num_units,
      num_layers=num_layers,
      num_residual_layers=num_residual_layers,
      forget_bias=forget_bias,
      dropout=dropout,
      mode=mode,
      trainable=trainable)

  # Encode.
  outputs, final_state = tf.nn.dynamic_rnn(
      cell, sequences,
      sequence_length=length,
      dtype=tf.float32,
      time_major=False)

  return outputs, final_state
Builds sequences encoded with a unidirectional RNN.
language/labs/consistent_zero_shot_nmt/utils/model_utils.py