import tensorflow as tf

    final_loss = tf.reduce_mean(loss)

    return final_loss


def contra_traj_lossV1(pred, tgt, temp=10.0):
    # Trajectory-wise contrastive loss
    traj_pred = tf.reduce_mean(pred, axis=1)
    traj_tgt = tf.reduce_mean(tgt, axis=1)
    p1, p2 = tf.split(traj_pred, 2, axis=0)
    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)
    return loss


def horizon_sumV1(input, horizon=12):
