import tensorflow as tf

    loss = tf.maximum(0., tgt_posi_dif - pred_posi_dif)

    cstr_pct = tf.math.count_nonzero(loss, dtype=tf.float32) / tf.cast(tf.reduce_prod(tf.shape(loss)), tf.float32)
    final_loss = tf.reduce_mean(loss)
