code: def compare_shapes(
      proto,
      input_key_values,
      expected_outputs,
      use_cpu_only=False,
      pred=None,
  ):
      """
      Inputs:
          - proto: MLModel proto.
  
          - input_key_values: str -> np.array. Keys must match those in
            input_placeholders.
  
          - expected_outputs: dict[str, np.array].
  
          - use_cpu_only: True/False.
  
          - pred: Prediction to use, if it has already been computed.
      """
  
      if _IS_MACOS:
          if not pred:
              pred = run_core_ml_predict(
                  proto, input_key_values, use_cpu_only
              )
          for o, expected in expected_outputs.items():
              msg = "Output: {}. expected shape {} != actual shape {}".format(
                  o, expected.shape, pred[o].shape
              )
              # Core ML does not support scalar as output
              # remove this special case when support is added
              if expected.shape == () and pred[o].shape == (1,):
                  continue
              assert pred[o].shape == expected.shape, msg
  
imports: import logging
  import numpy
  import copy
  import coremltools
  from coremltools import converters
  from coremltools.converters.mil import converter
  from coremltools.converters.mil.mil import Program, Function
  from coremltools.converters.mil.mil.passes.pass_registry import PASS_REGISTRY
  from coremltools._deps import _IS_MACOS
label_desc: Use image node_id 12 for calling a global function with example usage: compare_shapes(proto, input_key_values, expected_outputs, use_cpu_only, pred) without return types