code: def _neural_sort(logits, temperature=1.0):
      """Non-tensor version of neural sort."""
      batch_size = len(logits)
      list_size = len(logits[0])
  
      result = []
      for b in range(batch_size):
          smooth_perm = []
          logit_diff_sum = [
              sum(abs(m - l) for m in logits[b]) for l in logits[b]
          ]
          for i in range(list_size):
              scaling = list_size + 1 - 2 * (i + 1)
              scaled_logits = [scaling * l for l in logits[b]]
              p_logits = [
                  (l - s) / temperature
                  for l, s in zip(scaled_logits, logit_diff_sum)
              ]
              p_logits = [l - max(p_logits) for l in p_logits]
              smooth_perm.append(_softmax(p_logits))
          result.append(smooth_perm)
  
      return result
  
imports: import math
  import tensorflow
  from tensorflow_ranking.python import losses
  from tensorflow_ranking.python import losses_impl
label_desc: Use image node_id 7 for calling a global function with example usage: _neural_sort(logits, temperature) and returns: result