code: def test_make_loss_metric_fn(self):
      with tf.Graph().as_default():
          scores = [[1.0, 3.0, 2.0], [1.0, 2.0, 3.0]]
          labels = [[0.0, 0.0, 1.0], [0.0, 0.0, 2.0]]
          weights = [[2.0], [1.0]]
          weights_feature_name = "weights"
          features = {
              weights_feature_name: weights,
          }
          m = ranking_losses.make_loss_metric_fn(
              ranking_losses.RankingLossKey.SOFTMAX_LOSS
          )
          m_w = ranking_losses.make_loss_metric_fn(
              ranking_losses.RankingLossKey.SOFTMAX_LOSS,
              weights_feature_name=weights_feature_name,
          )
          self._check_metrics(
              [
                  (
                      m(labels, scores, features),
                      -(
                          math.log(_softmax(scores[0])[2])
                          + math.log(_softmax(scores[1])[2]) * 2.0
                      )
                      / 3.0,
                  ),
                  (
                      m_w(labels, scores, features),
                      -(
                          math.log(_softmax(scores[0])[2]) * 2.0
                          + math.log(_softmax(scores[1])[2]) * 2.0 * 1.0
                      )
                      / 4.0,
                  ),
              ]
          )
  
          # Value of loss metric is the same as loss with MEAN reduction.
          with self.cached_session():
              loss_fn_mean = ranking_losses.make_loss_fn(
                  ranking_losses.RankingLossKey.SOFTMAX_LOSS,
                  reduction=tf.compat.v1.losses.Reduction.MEAN,
              )
              loss_mean = loss_fn_mean(labels, scores, features).eval()
          self._check_metrics(
              [
                  (m(labels, scores, features), loss_mean),
              ]
          )
  
imports: import math
  import tensorflow
  from tensorflow_ranking.python import losses
  from tensorflow_ranking.python import losses_impl
label_desc: Use image node_id 3 for calling the LossMetricTest obj's underlying member method code with example usage: obj.test_make_loss_metric_fn() without return types