Masking matrix such that element i,j is 1 iff y[i] == y2[i].
    :param y: a list of labels
    :param y2: a list of labels

    :returns: A tensor for the masking matrix.

def same_label_mask(y, y2):
    """Masking matrix such that element i,j is 1 iff y[i] == y2[i].
    :param y: a list of labels
    :param y2: a list of labels

    :returns: A tensor for the masking matrix.
    """
    return tf.cast(tf.squeeze(tf.equal(y, tf.expand_dims(y2, 1))), tf.float32)