code: def _assert_torch_coreml_output_shapes(
      coreml_model,
      spec,
      torch_model,
      torch_example_input,
      is_image_input=False,
  ):
      torch_out = torch_model(torch_example_input)
      input_name = spec.description.input[0].name
      output_name = spec.description.output[0].name
      input_dict = {}
      if is_image_input:
          input_dict[input_name] = _numpy_array_to_pil_image(
              torch_example_input.numpy()
          )
      else:
          input_dict[input_name] = torch_example_input.numpy()
      coreml_out = coreml_model.predict(input_dict)[output_name]
      assert torch_out.shape == coreml_out.shape
      snr, psnr = _compute_snr(
          torch_out.cpu().detach().numpy(), coreml_out
      )
      _np.testing.assert_array_less(20, snr)
      _np.testing.assert_array_less(30, psnr)
  
imports: import itertools
  import os
  import tempfile
  import numpy
  import PIL.Image
  import pytest
  import coremltools
  from coremltools._deps import _HAS_TF_2, _HAS_TORCH, MSG_TF2_NOT_FOUND, MSG_TORCH_NOT_FOUND
  from coremltools.converters.mil import Builder
  from coremltools.converters.mil.testing_reqs import backends, compute_units
label_desc: Use image node_id 3 for calling a global function with example usage: _assert_torch_coreml_output_shapes(coreml_model, spec, torch_model, torch_example_input, is_image_input) without return types