import tensorflow as tf


      rnnout, _, _ = tf.nn.bidirectional_rnn(cell_fw, cell_bw, self._inputs,
                                             dtype=tf.float32,
                                             sequence_length=self.seq_lens)
      if proj_size:
        out_size = 2 * proj_size
      else:
        out_size = 2 * hidden_size
      self._DoPredictions(out_size, rnnout, self.weights)

      self.cost = tf.reduce_mean(self.example_weights * self._xent)

  def _DoPredictions(self, in_size, mats, class_weights=None):
    """Takes in an array of states and calculates predictions.

    Get the cross-entropy for each example in the vector self._xent.

    Args:
      in_size: size of the hidden state vectors
      mats: list of hidden state vectors
