code: def test_model_to_saved_model_dense_inputs(self):
      # TODO: Add SavedModel support for sparse inputs.
      # After adding @tf.function decorator, _predict function breaks for
      # sparse inputs to Keras model.
      example_feature_columns = {}
      example_feature_columns.update(self.example_feature_columns)
      # Remove sparse feature based EmbeddingColumn.
      del example_feature_columns["unigrams"]
      network = _DummyUnivariateRankingNetwork(
          context_feature_columns=self.context_feature_columns,
          example_feature_columns=example_feature_columns,
      )
      ranker = model_lib.create_keras_model(
          network=network,
          loss=self.loss,
          metrics=self.metrics,
          optimizer=self.optimizer,
          size_feature_name="example_list_size",
      )
  
      context_feature_spec = tf.feature_column.make_parse_example_spec(
          network.context_feature_columns.values()
      )
      example_feature_spec = tf.feature_column.make_parse_example_spec(
          network.example_feature_columns.values()
      )
  
      eval_batch_size = 2
  
      @tf.function(
          input_signature=[
              tf.TensorSpec(shape=(eval_batch_size,), dtype=tf.string)
          ]
      )
      def _predict(serialized):
          features = data.parse_from_example_list(
              serialized,
              context_feature_spec=context_feature_spec,
              example_feature_spec=example_feature_spec,
              size_feature_name="example_list_size",
          )
          scores = ranker(inputs=features, training=False)
          return {"predictions": scores}
  
      ranker.infer_from_proto = _predict
  
      # Export the model to a SavedModel.
      tf.saved_model.save(
          ranker,
          export_dir="/tmp/functional_keras_model",
          signatures={"predict": ranker.infer_from_proto},
      )
  
      # Import ranker from SavedModel.
      imported = tf.saved_model.load("/tmp/functional_keras_model")
      imported_ranker_predictor = imported.signatures["predict"]
      output = imported_ranker_predictor(
          tf.convert_to_tensor(
              [
                  EXAMPLE_LIST_PROTO_1.SerializeToString(),
                  EXAMPLE_LIST_PROTO_2.SerializeToString(),
              ]
          )
      )["predictions"]
  
      features = {}
      features.update(self.features)
      # TODO: Add SavedModel support for sparse inputs.
      # After adding @tf.function decorator, _predict function breaks for
      # sparse inputs to Keras model. Hence ranker is also created and called
      # only on dense features. Removing "unigrams", a sparse feature.
      del features["unigrams"]
      self.assertAllClose(
          ranker(features, training=False).numpy(), output.numpy()
      )
  
imports: from absl.testing import parameterized
  import tensorflow
  from google.protobuf import text_format
  from tensorflow_ranking.python import data
  from tensorflow_ranking.python.keras import feature
  from tensorflow_ranking.python.keras import losses
  from tensorflow_ranking.python.keras import metrics
  from tensorflow_ranking.python.keras import model
  from tensorflow_ranking.python.keras import network
  from tensorflow_serving.apis import input_pb2
label_desc: Use image node_id 4 for calling the FunctionalRankingModelTest obj's underlying member method code with example usage: obj.test_model_to_saved_model_dense_inputs() and returns: dict