code: def _pairwise_soft_zero_one_loss(
      labels,
      logits,
      weights=None,
      lambda_weight=None,
      reduction=tf.compat.v1.losses.Reduction.SUM_BY_NONZERO_WEIGHTS,
      name=None,
  ):
      """Computes the pairwise soft zero-one loss.
  
      Note this is different from sigmoid cross entropy in that soft zero-one loss
      is a smooth but non-convex approximation of zero-one loss. The preference
      probability of each pair is computed as the sigmoid function: P(l_i > l_j) = 1
      / (1 + exp(s_j - s_i)). Then 1 - P(l_i > l_j) is directly used as the loss.
      So a correctly ordered pair has a loss close to 0, while an incorrectly
      ordered pair has a loss bounded by 1.
  
      Args:
        labels: A `Tensor` of the same shape as `logits` representing graded
          relevance.
        logits: A `Tensor` with shape [batch_size, list_size]. Each value is the
          ranking score of the corresponding item.
        weights: A scalar, a `Tensor` with shape [batch_size, 1] for list-wise
          weights, or a `Tensor` with shape [batch_size, list_size] for item-wise
          weights.
        lambda_weight: A `_LambdaWeight` object.
        reduction: One of `tf.losses.Reduction` except `NONE`. Describes how to
          reduce training loss over batch.
        name: A string used as the name for this loss.
  
      Returns:
        An op for the pairwise soft zero one loss.
      """
      loss = losses_impl.PairwiseSoftZeroOneLoss(name, lambda_weight)
      with tf.compat.v1.name_scope(
          loss.name,
          "pairwise_soft_zero_one_loss",
          (labels, logits, weights),
      ):
          return loss.compute(labels, logits, weights, reduction)
  
imports: from typing import Any, Callable, Dict, List, Mapping, Optional, Sequence, Tuple, Union
  import tensorflow
  from tensorflow_ranking.python import losses_impl
  from tensorflow_ranking.python import utils
label_desc: Use image node_id 8 for calling a global function with example usage: _pairwise_soft_zero_one_loss(labels, logits, weights, lambda_weight, reduction, name) and returns: loss