import tensorflow as tf

    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]))
    preds_weighted_reshaped = tf.reshape(preds_weighted,
                                         self.preds_by_word.get_shape())
    self.probs = tf.reduce_sum(preds_weighted_reshaped, 0)
    self._xent = _SafeXEnt(self.y, self.probs, class_weights=class_weights)
