def vanilla_rnn(seqs, hidden_size=50):
  """A basic RNN.

  Args:
    seqs: <tf.float32>[batch_size, total_len, pattern_size] Sequences of
      patterns, where `total_len` is the length of a sequence (including the
      query pattern) and `pattern_size` is the dimensionality of each pattern.
    hidden_size (int): Number of hidden units.

  Returns:
    preds: <tf.float32>[batch_size, pattern_size] The retrieved pattern for
      the degraded query at the end of the sequence.
  """
  pattern_size = seqs.shape[2]

  cell = tf.contrib.rnn.BasicRNNCell(hidden_size)

  # outputs: <tf.float32>[batch_size, total_len, hidden_size]
  # state (unused): <tf.float32>[batch_size, hidden_size]
  #
  # Note that output_size=cell_state_size=hidden_size in BasicRNNCell.
  outputs, _ = tf.nn.dynamic_rnn(cell=cell, dtype=tf.float32, inputs=seqs)

  # Return only the last output
  # preds: <tf.float32>[batch_size, pattern_size]
  # outputs[:, -1]: <tf.float32>[batch_size, hidden_size] is the last hidden
  #   representation for each element in the batch.
  # W: <tf.float32>[hidden_size, pattern_size]
  preds = tf.layers.dense(outputs[:, -1], pattern_size)

  return preds
A basic RNN.

  Args:
    seqs: <tf.float32>[batch_size, total_len, pattern_size] Sequences of
      patterns, where `total_len` is the length of a sequence (including the
      query pattern) and `pattern_size` is the dimensionality of each pattern.
    hidden_size (int): Number of hidden units.

  Returns:
    preds: <tf.float32>[batch_size, pattern_size] The retrieved pattern for
      the degraded query at the end of the sequence.
  
language/labs/memory/baseline_models.py