import tensorflow as tf

    labels = tf.to_float(labels)
    repeat_op = tf.to_float(
        tf.tile(tf.reshape(tf.range(0, num_ratings), [num_ratings, 1]), [1, num_ratings]))
    repeat_op_sq = tf.square((repeat_op - tf.transpose(repeat_op)))
    weights = repeat_op_sq / tf.to_float((num_ratings - 1)**2)

    pred_ = predictions**y_pow
    try:
