code: def test_model_to_saved_model_dense_inputs(self):
      dnn_scorer = model_lib.DNNScorer(
          hidden_layer_dims=[10, 10], output_units=1
      )
      dnn_model = model_lib.ModelBuilder(
          input_creator=self._input_creator,
          preprocessor=self._preprocessor,
          scorer=dnn_scorer,
          mask_feature_name="mask",
          name="test_model",
      ).build()
  
      @tf.function(
          input_signature=[tf.TensorSpec(shape=(1,), dtype=tf.string)]
      )
      def _predict(serialized):
          features = data.parse_from_example_list(
              serialized,
              context_feature_spec=self._context_feature_spec,
              example_feature_spec=self._example_feature_spec,
              mask_feature_name="mask",
          )
          scores = dnn_model(inputs=features, training=False)
          return {"predictions": scores}
  
      dnn_model.infer_from_proto = _predict
  
      # Export the model to a SavedModel.
      tf.saved_model.save(
          dnn_model,
          export_dir="/tmp/keras_model",
          signatures={"predict": dnn_model.infer_from_proto},
      )
  
      # Import ranker from SavedModel.
      imported = tf.saved_model.load("/tmp/keras_model")
      imported_model = imported.signatures["predict"]
      imported_output = imported_model(
          tf.convert_to_tensor([ELWC_PROTO.SerializeToString()])
      )["predictions"]
  
      output = dnn_model(
          {
              "context_1": tf.ragged.constant([[3, 1, 4, 1]]),
              "feature_1": tf.convert_to_tensor([[[0.0], [1], [2]]]),
              "feature_2": tf.convert_to_tensor([[[0.0], [1], [2]]]),
              "mask": tf.convert_to_tensor([[True, True, True]]),
          }
      )
      self.assertAllClose(output.numpy(), imported_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 5 for calling the ModelBuilderTest obj's underlying member method code with example usage: obj.test_model_to_saved_model_dense_inputs() and returns: dict