import tensorflow as tf

    t1, t2 = tf.split(traj_tgt, 2, axis=0)
    soft_sign = tf.tanh((t1 - t2) * temp)
    loss = tf.maximum(0.0, soft_sign * ((t1 - t2) - (p1 - p2)))
    loss = tf.reduce_mean(loss)
