code: def test_train_and_eval(self, loss_key):
      def _trainable_score_fn(context_features, example_features, mode):
          del context_features, mode
          input_layer = tf.ones_like(example_features["f1"])
          return tf.compat.v1.layers.dense(input_layer, units=1)
  
      hparams = _make_hparams(
          train_input_pattern=self._data_file,
          eval_input_pattern=self._data_file,
          model_dir=self._model_dir,
          list_size=None,
          num_train_steps=1,
          num_eval_steps=1,
          loss_key=loss_key,
      )
  
      estimator = tfr.estimator.EstimatorBuilder(
          _context_feature_columns(),
          _example_feature_columns(),
          _trainable_score_fn,
          hparams=hparams,
      ).make_estimator()
  
      pip = pipeline.RankingPipeline(
          _context_feature_columns(),
          _example_feature_columns(),
          hparams=hparams,
          estimator=estimator,
          label_feature_name="utility",
          label_feature_type=tf.float32,
      )
      pip.train_and_eval()
  
      hparams["listwise_inference"] = True
      pip_listwise_export = pipeline.RankingPipeline(
          _context_feature_columns(),
          _example_feature_columns(),
          hparams=hparams,
          estimator=estimator,
          label_feature_name="utility",
          label_feature_type=tf.float32,
      )
      pip_listwise_export.train_and_eval()
  
      # Does not support non-local training.
      with self.assertRaises(ValueError):
          pip.train_and_eval(local_training=False)
  
imports: import os
  from absl.testing import parameterized
  import tensorflow
  from tensorflow import estimator
  import tensorflow_ranking
  from google.protobuf import text_format
  from tensorflow_ranking.extension import pipeline
  from tensorflow_serving.apis import input_pb2
label_desc: Use image node_id 6 for calling the RankingPipelineTest obj's underlying member method code with example usage: obj.test_train_and_eval(loss_key) and returns: tf