code: def testParseSavedModelSignature(self):
      model_path = self._MockSavedModel(
          {
              "meta_graphs": [
                  {
                      "meta_info_def": {"tags": ["serve"]},
                      "signature_def": {
                          "foo": {
                              "method_name": "tensorflow/serving/predict",
                              "inputs": {
                                  "x": {
                                      "name": "serving_default_input:0",
                                      "dtype": "DT_FLOAT",
                                      "tensor_shape": {
                                          "dim": [
                                              {"size": -1},
                                              {"size": 784},
                                          ]
                                      },
                                  }
                              },
                              "outputs": {
                                  "y": {
                                      "name": "StatefulPartitionedCall:0",
                                      "dtype": "DT_FLOAT",
                                      "tensor_shape": {
                                          "dim": [
                                              {"size": -1},
                                              {"size": 10},
                                          ]
                                      },
                                  }
                              },
                          }
                      },
                  }
              ]
          }
      )
  
      signatures = request_builder._parse_saved_model_signatures(
          model_path, tag_set={"serve"}, signature_names=["foo"]
      )
  
      self.assertEqual(
          signatures["foo"].inputs["x"].dtype,
          tf.dtypes.float32.as_datatype_enum,
      )
      self.assertEqual(
          signatures["foo"].inputs["x"].tensor_shape,
          tf.TensorShape([None, 784]).as_proto(),
      )
      self.assertEqual(
          signatures["foo"].outputs["y"].dtype,
          tf.dtypes.float32.as_datatype_enum,
      )
      self.assertEqual(
          signatures["foo"].outputs["y"].tensor_shape,
          tf.TensorShape([None, 10]).as_proto(),
      )
  
imports: import os
  from typing import Any, Dict
  from unittest import mock
  import tensorflow
  from tfx.components.infra_validator import request_builder
  from tfx.proto import infra_validator_pb2
  from tfx.types import artifact_utils
  from tfx.types import standard_artifacts
  from tfx.utils import path_utils
  from google.protobuf import json_format
  from tensorflow.core.protobuf import meta_graph_pb2
  from tensorflow.core.protobuf import saved_model_pb2
  from tensorflow_serving.apis import classification_pb2
  from tensorflow_serving.apis import predict_pb2
  from tensorflow_serving.apis import regression_pb2
label_desc: Use image node_id 2 for calling the TestParseSavedModelSignature obj's underlying member method code with example usage: obj.testParseSavedModelSignature() without return types