code: def test_model_signature_with_tensorspec():
      signature1 = ModelSignature(
          inputs=Schema([TensorSpec(np.dtype("float"), (-1, 28, 28))]),
          outputs=Schema([TensorSpec(np.dtype("float"), (-1, 10))]),
      )
      signature2 = ModelSignature(
          inputs=Schema([TensorSpec(np.dtype("float"), (-1, 28, 28))]),
          outputs=Schema([TensorSpec(np.dtype("float"), (-1, 10))]),
      )
      # Single type mismatch
      assert signature1 == signature2
      signature3 = ModelSignature(
          inputs=Schema([TensorSpec(np.dtype("float"), (-1, 28, 28))]),
          outputs=Schema([TensorSpec(np.dtype("int"), (-1, 10))]),
      )
      assert signature3 != signature1
      # Name mismatch
      signature4 = ModelSignature(
          inputs=Schema([TensorSpec(np.dtype("float"), (-1, 28, 28))]),
          outputs=Schema(
              [TensorSpec(np.dtype("float"), (-1, 10), "misMatch")]
          ),
      )
      assert signature3 != signature4
      as_json = json.dumps(signature1.to_dict())
      signature5 = ModelSignature.from_dict(json.loads(as_json))
      assert signature1 == signature5
  
      # Test with name
      signature6 = ModelSignature(
          inputs=Schema(
              [
                  TensorSpec(
                      np.dtype("float"), (-1, 28, 28), name="image"
                  ),
                  TensorSpec(
                      np.dtype("int"), (-1, 10), name="metadata"
                  ),
              ]
          ),
          outputs=Schema(
              [TensorSpec(np.dtype("float"), (-1, 10), name="outputs")]
          ),
      )
      signature7 = ModelSignature(
          inputs=Schema(
              [
                  TensorSpec(
                      np.dtype("float"), (-1, 28, 28), name="image"
                  ),
                  TensorSpec(
                      np.dtype("int"), (-1, 10), name="metadata"
                  ),
              ]
          ),
          outputs=Schema(
              [TensorSpec(np.dtype("float"), (-1, 10), name="outputs")]
          ),
      )
      assert signature6 == signature7
      assert signature1 != signature6
  
      # Test w/o output
      signature8 = ModelSignature(
          inputs=Schema([TensorSpec(np.dtype("float"), (-1, 28, 28))]),
          outputs=None,
      )
      as_json = json.dumps(signature8.to_dict())
      signature9 = ModelSignature.from_dict(json.loads(as_json))
      assert signature8 == signature9
  
imports: import json
  import numpy
  import pandas
  import pyspark
  import pytest
  from sklearn.ensemble import RandomForestRegressor
  import mlflow
  from mlflow.exceptions import MlflowException
  from mlflow.models import Model, ModelSignature, infer_signature, set_signature
  from mlflow.models.model import get_model_info
  from mlflow.types import DataType
  from mlflow.types.schema import Array, ColSpec, ParamSchema, ParamSpec, Schema, TensorSpec
label_desc: Use image node_id 2 for calling a global function with example usage: test_model_signature_with_tensorspec() without return types