import tensorflow as tf

    tgt_small = tf.where(geq, tgt2, tgt1)
    pred_larg = tf.where(geq, pred1, pred2)
    pred_small = tf.where(geq, pred2, pred1)

    loss = tf.maximum(0.0, ((tgt_larg - tgt_small) - (pred_larg - pred_small)))
    loss = tf.reduce_mean(loss)
    return loss

