import tensorflow as tf

            for i in range(len(sliced_output)):
                for j in range(i+1, len(sliced_output)):
                    cur_label_weight = tf.math.sign(sliced_label[i] - sliced_label[j])
                    cur_propensity = sliced_propensity[i] * sliced_label[i] + sliced_propensity[j] * sliced_label[j]
                    cur_pair_loss = -tf.exp(sliced_output[i]) / (tf.exp(sliced_output[i]) + tf.exp(sliced_output[j]))
                    if loss == None:
                        loss = cur_label_weight * cur_pair_loss * cur_propensity
                    loss += cur_label_weight * cur_pair_loss * cur_propensity
