import tensorflow as tf


    Args:
      in_size: size of the hidden state vectors
      mats: list of hidden state vectors
    """
    pred_mat = tf.get_variable('pred_mat',
                               [in_size, self._out_vocab_size])
    pred_bias = tf.get_variable('pred_bias', [self._out_vocab_size])

    # Make a prediction on every word.
    def GetWordPred(o_):
      logits = tf.nn.xw_plus_b(o_, pred_mat, pred_bias)
      return tf.nn.softmax(logits)

    self.preds_by_word = tf.pack([GetWordPred(o_) for o_ in mats])
    self.cs = self._mask / tf.reduce_sum(self._mask, 1, keep_dims=True)

    # The final prediction is the average of the predictions for each word
    # weighted by the individual confidence/utility scores.
    preds_weighted = tf.mul(tf.reshape(tf.transpose(self.cs), [-1, 1]),
                            tf.reshape(self.preds_by_word,
                                       [-1, self._out_vocab_size]))
