class_docstr: Groupwise RankingEstimator tests.
docstr: Load a static checkpoint and test predict function.
docstr_tok: ["Load","a","static","checkpoint","and","test","predict","function","."]
code: def test_predict(self):
      """Load a static checkpoint and test predict function."""
      self._initialize_checkpoint()
      self._assert_checkpoint(
          expected_global_step=100,
          expected_bias=[1.0, 1.0],
          expected_weights=[[1.0, 1.0], [2.0, 2.0], [3.0, 3.0]],
      )
      # When infer_list_size = 2, inference will have the following groups [0, 1],
      # [1, 0] given group_size = 2.
      features = {
          "context": [[178.0], [155.0]],
          "age": [[[10.0], [20.0]], [[50.0], [30.0]]],
      }
      predictions = self._estimator.predict(
          input_fn=lambda: (features, None)
      )
      self.assertAllClose([254.0, 254.0], list(next(predictions)))
      self.assertAllClose([356.0, 356.0], list(next(predictions)))
  
      # When infer_list_size = 4, inference will have the following groups [0, 1],
      # [1, 2], [2, 3], [3, 0] given group_size = 2.
      features = {
          "context": [[178.0], [178.0], [178.0]],
          "age": [
              [[20.0], [10.0], [10.0], [10.0]],
              [[20.0], [10.0], [10.0], [10.0]],
              [[20.0], [10.0], [10.0], [10.0]],
          ],
      }
      predictions = self._estimator.predict(
          input_fn=lambda: (features, None)
      )
      self.assertAllClose(
          [254.0, 239.0, 229.0, 244.0], list(next(predictions))
      )
      self.assertAllClose(
          [254.0, 239.0, 229.0, 244.0], list(next(predictions))
      )
      self.assertAllClose(
          [254.0, 239.0, 229.0, 244.0], list(next(predictions))
      )
  
      # Evaluation after training.
      self._estimator.train(input_fn=_train_input_fn, steps=1)
  
      features = {
          "context": [[178.0], [155.0]],
          "age": [[[10.0], [20.0]], [[50.0], [30.0]]],
      }
      predictions = self._estimator.predict(
          input_fn=lambda: (features, None)
      )
      self.assertAllClose([255.0, 253.0], list(next(predictions)))
      self.assertAllClose([354.0, 358.0], list(next(predictions)))
  
      features = {
          "context": [[178.0], [178.0], [178.0]],
          "age": [
              [[20.0], [10.0], [10.0], [10.0]],
              [[20.0], [10.0], [10.0], [10.0]],
              [[20.0], [10.0], [10.0], [10.0]],
          ],
      }
      predictions = self._estimator.predict(
          input_fn=lambda: (features, None)
      )
      self.assertAllClose(
          [253.0, 239.5, 229.0, 244.5], list(next(predictions))
      )
      self.assertAllClose(
          [253.0, 239.5, 229.0, 244.5], list(next(predictions))
      )
      self.assertAllClose(
          [253.0, 239.5, 229.0, 244.5], list(next(predictions))
      )
  
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 8 for calling the GroupwiseRankingEstimatorTest obj's underlying member method code with example usage: obj.test_predict() without return types