code: def compare_backend(
      mlmodel,
      input_key_values,
      expected_outputs,
      dtype="fp32",
      atol=1e-04,
      rtol=1e-05,
      also_compare_shapes=True,
  ):
      """
      Inputs:
          - mlmodel: MLModel.
  
          - input_key_values: str -> np.array. Keys must match those in
            input_placeholders.
  
          - expected_outputs: dict[str, np.array]. Required iff
            frontend_only is False
      """
      if _IS_MACOS and (
          not mlmodel.is_package
          or coremltoolsutils._macos_version() >= (12, 0)
      ):
          if dtype not in ["fp32", "fp16"]:
              raise ValueError("Unsupported dtype config")
  
          pred = run_core_ml_predict(mlmodel, input_key_values)
          if also_compare_shapes:
              compare_shapes(
                  mlmodel,
                  input_key_values,
                  expected_outputs,
                  pred=pred,
              )
          if mlmodel.compute_unit != ct.ComputeUnit.CPU_ONLY or (
              dtype == "fp16"
          ):
              atol = max(atol * 100.0, 5e-1)
              rtol = max(rtol * 100.0, 5e-2)
          for o, expected in expected_outputs.items():
              coreml_out = _get_coreml_out_from_dict(pred, o)
  
              if isinstance(coreml_out, np.ndarray):
                  np.testing.assert_allclose(
                      coreml_out, expected, atol=atol, rtol=rtol
                  )
              elif isinstance(coreml_out, dict):
                  for k, v in coreml_out.items():
                      assert k in expected
                      assert expected[k] == v
              else:
                  assert coreml_out == expected
  
          return pred
      return None
  
imports: import itertools
  import copy
  import os
  from functools import partial
  from pathlib import Path
  from typing import Dict, List, Tuple
  import numpy
  import pytest
  from PIL import Image
  import coremltools
  import coremltools.models.utils
  from coremltools._deps import _IS_MACOS
  from coremltools.converters.mil.mil import Block, Function, Program
  from coremltools.converters.mil.mil.passes.defs.preprocess import NameSanitizer
  from coremltools.converters.mil.mil.passes.defs.quantization import AbstractQuantizationPass
  from coremltools.converters.mil.mil.passes.pass_registry import PASS_REGISTRY
  from coremltools.proto import FeatureTypes_pb2
label_desc: Use image node_id 20 for calling a global function with example usage: compare_backend(mlmodel, input_key_values, expected_outputs, dtype, atol, rtol, also_compare_shapes) and returns: None, pred