import tensorflow as tf

        pred2 = tf.slice(batch2, [0, 0], [num_sam, 1])
        tgt1 = tf.slice(batch1, [0, 1], [num_sam, 1])
        tgt2 = tf.slice(batch2, [0, 1], [num_sam, 1])
        loss = cur_loss + compute_contra_loss(pred1, pred2, tgt1, tgt2)
