class_docstr: GroupwiseRankingModel tests.
code: def test_compute_logits(self, mode):
      group_size = 2
      params = {
          "num_shuffles_train": 2,
          "num_shuffles_eval": 2,
          "num_shuffles_predict": 2,
      }
  
      def _dummy_score_fn(
          context_features, group_features, mode, params, config
      ):
          del [mode, params, config]
          # 'context': [batch_size * num_groups, 1]
          # 'example_f1': [batch_size * num_groups, group_size, 1]
          logits = (
              tf.expand_dims(context_features["context"], axis=1)
              + group_features["example_f1"]
          )
          logits = tf.reshape(logits, [-1, group_size])
          # Add the shape of the logits to differentiate number of shuffles.
          return logits + tf.cast(tf.shape(input=logits)[0], tf.float32)
  
      tf.random.set_seed(1)
      ranking_model = model._GroupwiseRankingModel(
          _dummy_score_fn,
          group_size=group_size,
          transform_fn=feature.make_identity_transform_fn(["context"]),
      )
  
      # batch_size = 1, list_size = 3, is_valid = [True, True, False]
      features = {
          "context": [[1.0]],
          "example_f1": [[[1.0], [2.0], [3.0]]],
      }
      labels = [[1.0, 0, -1]]
      # No params.
      logits = ranking_model.compute_logits(
          features, labels, mode, None, None
      )
      self.assertEqual(
          ranking_model._feature_gather_indices.get_shape().as_list(),
          [1, 3, 2, 2],
      )
      self.assertAllEqual(logits, [[5.0, 6.0, 0.0]])
      # Trigger params.
      logits = ranking_model.compute_logits(
          features, labels, mode, params, None
      )
      self.assertEqual(
          ranking_model._feature_gather_indices.get_shape().as_list(),
          [1, 6, 2, 2],
      )
      self.assertAllEqual(logits, [[8.0, 9.0, 0.0]])
  
      # batch_size = 1, list_size = 3, is_valid = [True, True, True]
      features = {
          "context": [[1.0]],
          "example_f1": [[[1.0], [2.0], [0.0]]],
      }
      labels = [[1.0, 0, 1]]
      logits = ranking_model.compute_logits(
          features, labels, mode, params, None
      )
      self.assertEqual(
          ranking_model._feature_gather_indices.get_shape().as_list(),
          [1, 6, 2, 2],
      )
      self.assertAllEqual(logits, [[8.0, 9.0, 7.0]])
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  from absl.testing import parameterized
  import tensorflow
  from tensorflow import estimator
  from tensorflow_ranking.python import feature
  from tensorflow_ranking.python import head
  from tensorflow_ranking.python import losses
  from tensorflow_ranking.python import model
label_desc: Use image node_id 4 for calling the GroupwiseRankingModelTest obj's underlying member method code with example usage: obj.test_compute_logits(mode) and returns: unknown