code: def test_parse_tf_serving_dictionary():
      # instances are correctly aggregated to dict of input name -> tensor
      tfserving_input = {
          "instances": [
              {"a": "s1", "b": 1.1, "c": [1, 2, 3]},
              {"a": "s2", "b": 2.2, "c": [4, 5, 6]},
              {"a": "s3", "b": 3.3, "c": [7, 8, 9]},
          ]
      }
      # Without Schema
      result = parse_tf_serving_input(tfserving_input)
      expected_result_no_schema = {
          "a": np.array(["s1", "s2", "s3"]),
          "b": np.array([1.1, 2.2, 3.3]),
          "c": np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]),
      }
      assert_result(result, expected_result_no_schema)
  
      # With schema
      schema = Schema(
          [
              TensorSpec(np.dtype("str"), [-1], "a"),
              TensorSpec(np.dtype("float32"), [-1], "b"),
              TensorSpec(np.dtype("int32"), [-1], "c"),
          ]
      )
      df_schema = Schema(
          [
              ColSpec("string", "a"),
              ColSpec("float", "b"),
              ColSpec("integer", "c"),
          ]
      )
      result = parse_tf_serving_input(tfserving_input, schema)
      expected_result_schema = {
          "a": np.array(["s1", "s2", "s3"], dtype=np.dtype("str")),
          "b": np.array([1.1, 2.2, 3.3], dtype="float32"),
          "c": np.array(
              [[1, 2, 3], [4, 5, 6], [7, 8, 9]], dtype="int32"
          ),
      }
      assert_result(result, expected_result_schema)
      # With df Schema
      result = parse_tf_serving_input(tfserving_input, df_schema)
      assert_result(result, expected_result_schema)
      # With df Schema containing array
      new_schema = _infer_schema(tfserving_input["instances"])
      result = parse_tf_serving_input(tfserving_input, new_schema)
      expected_result = {
          "a": np.array(["s1", "s2", "s3"]),
          "b": np.array([1.1, 2.2, 3.3], dtype="float64"),
          "c": np.array(
              [[1, 2, 3], [4, 5, 6], [7, 8, 9]], dtype="int64"
          ),
      }
      assert_result(result, expected_result)
  
      # input provided as a dict
      tfserving_input = {
          "inputs": {
              "a": ["s1", "s2", "s3"],
              "b": [1.1, 2.2, 3.3],
              "c": [[1, 2, 3], [4, 5, 6], [7, 8, 9]],
          }
      }
      # Without Schema
      result = parse_tf_serving_input(tfserving_input)
      assert_result(result, expected_result_no_schema)
  
      # With Schema
      result = parse_tf_serving_input(tfserving_input, schema)
      assert_result(result, expected_result_schema)
  
      # With df Schema
      result = parse_tf_serving_input(tfserving_input, df_schema)
      assert_result(result, expected_result_schema)
  
imports: import base64
  import datetime
  import json
  import numpy
  import pandas
  import pytest
  from google.protobuf.text_format import Parse
  from mlflow.entities import Experiment, Metric
  from mlflow.entities.model_registry import ModelVersion, RegisteredModel
  from mlflow.exceptions import MlflowException
  from mlflow.protos.model_registry_pb2 import RegisteredModel
  from mlflow.protos.service_pb2 import Experiment
  from mlflow.protos.service_pb2 import Metric
  from mlflow.types import ColSpec, DataType, Schema, TensorSpec
  from mlflow.types.schema import Array, Object, Property
  from mlflow.types.utils import _infer_schema
  from mlflow.utils.proto_json_utils import MlflowFailedTypeConversion, _CustomJsonEncoder, _stringify_all_experiment_ids, cast_df_types_according_to_schema, dataframe_from_parsed_json, dataframe_from_raw_json, message_to_json, parse_dict, parse_tf_serving_input
  from tests.protos.test_message_pb2 import TestMessage
label_desc: Use image node_id 7 for calling a global function with example usage: test_parse_tf_serving_dictionary() without return types