code: def test_make_gumbel_approx_ndcg_fn(self):
      scores = [[1.4, -2.8, -0.4], [0.0, 1.8, 10.2], [1.0, 1.2, -3.2]]
      labels = [[0.0, 2.0, 1.0], [1.0, 0.0, 3.0], [1.0, 0.0, 0.0]]
      weights = [[2.0], [1.0], [1.0]]
  
      # sampled_scores = [[-1.7508768e-1, -4.6947412, -1.887345],
      #                   [-3.6629683e-1, -3.4472363, -1.2914587],
      #                   [-7.654705, -8.3514204, -7.1014347e-4],
      #                   [-10.080214, -8.7212124, -2.0500139e-4],
      #                   [-2.0658800e-1, -1.678545, -46.035358],
      #                   [-2.3852456e-1, -1.550176, -46.028168]]
      # sampled_rank = [[1, 3, 2],
      #                 [1, 3, 2],
      #                 [2, 3, 1],
      #                 [3, 2, 1],
      #                 [1, 2, 3],
      #                 [1, 2, 3]]
      # expanded_labels = [[0., 2., 1.], [0., 2., 1.],
      #                    [1., 0., 3.], [1., 0., 3.],
      #                    [1., 0., 0.], [1., 0., 0.]]
      # expanded_weights = [[2.], [2.], [1.], [1.], [1.], [1.]]
  
      weights_feature_name = "weights"
      features = {weights_feature_name: weights}
  
      tf.random.set_seed(1)
      loss_fn_simple = ranking_losses.make_loss_fn(
          ranking_losses.RankingLossKey.GUMBEL_APPROX_NDCG_LOSS,
          reduction=tf.compat.v1.losses.Reduction.SUM,
          params={"temperature": 0.001},
          gumbel_params={"sample_size": 2, "seed": 1},
      )
      self.assertAlmostEqual(
          loss_fn_simple(labels, scores, features).numpy(),
          -(
              (2 / (3 / ln(2) + 1 / ln(3))) * (1 / ln(3) + 3 / ln(4))
              + (1 / (7 / ln(2) + 1 / ln(3))) * (7 / ln(2) + 1 / ln(3))
              + (1 / (7 / ln(2) + 1 / ln(3))) * (7 / ln(2) + 1 / ln(4))
              + (2 / (1 / ln(2))) * (1 / ln(2))
          ),
          places=5,
      )
  
      tf.random.set_seed(1)
      loss_fn_weighted = ranking_losses.make_loss_fn(
          ranking_losses.RankingLossKey.GUMBEL_APPROX_NDCG_LOSS,
          weights_feature_name=weights_feature_name,
          reduction=tf.compat.v1.losses.Reduction.SUM,
          params={"temperature": 0.001},
          gumbel_params={"sample_size": 2, "seed": 1},
      )
      self.assertAlmostEqual(
          loss_fn_weighted(labels, scores, features).numpy(),
          -(
              2
              * (2 / (3 / ln(2) + 1 / ln(3)))
              * (1 / ln(3) + 3 / ln(4))
              + (1 / (7 / ln(2) + 1 / ln(3))) * (7 / ln(2) + 1 / ln(3))
              + (1 / (7 / ln(2) + 1 / ln(3))) * (7 / ln(2) + 1 / ln(4))
              + (2 / (1 / ln(2))) * (1 / ln(2))
          ),
          places=5,
      )
  
imports: import math
  import tensorflow
  from tensorflow_ranking.python import losses
  from tensorflow_ranking.python import losses_impl
label_desc: Use image node_id 16 for calling the LossesTest obj's underlying member method code with example usage: obj.test_make_gumbel_approx_ndcg_fn() without return types