code: def test_make_pwa_fn(self):
      with tf.Graph().as_default():
          scores = [[3.0, 2.0, 1.0], [3.0, 2.0, 1.0], [3.0, 2.0, 1.0]]
          labels = [[1.0, 2.0, 0.0], [2.0, 0.0, 1.0], [0.0, 2.0, 1.0]]
          weights = [[2.0], [3.0], [4.0]]
          num_queries = len(scores)
          weights_feature_name = "weights"
          features = {weights_feature_name: weights}
          m = metrics_lib.make_ranking_metric_fn(
              metrics_lib.RankingMetricKey.PWA
          )
          m_2 = metrics_lib.make_ranking_metric_fn(
              metrics_lib.RankingMetricKey.PWA, topn=2
          )
          m_w = metrics_lib.make_ranking_metric_fn(
              metrics_lib.RankingMetricKey.PWA,
              weights_feature_name=weights_feature_name,
          )
          self._check_metrics(
              [
                  (
                      m(labels, scores, features),
                      (
                          ((2.0 + 7.0 / 3.0 + 4.0 / 3.0) / (11.0 / 6.0))
                          / num_queries
                      ),
                  ),
                  (
                      m_2(labels, scores, features),
                      (((2.0 + 2.0 + 1.0) / (3.0 / 2.0)) / num_queries),
                  ),
                  (
                      m_w(labels, scores, features),
                      (
                          (2.0 * 2.0 + 3.0 * 7.0 / 3.0 + 4 * 4.0 / 3.0)
                          / (11.0 / 6.0)
                      )
                      / (2.0 + 3.0 + 4.0),
                  ),
              ]
          )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import functools
  import math
  import tensorflow
  from tensorflow_ranking.python import metrics
label_desc: Use image node_id 4 for calling the MetricsTest obj's underlying member method code with example usage: obj.test_make_pwa_fn() without return types