code: def run(
      self,
      inputs,  # type: Any
      **kwargs,  # type: Any
  ):
      # type: (...) -> Tuple[Any, ...]
      super(CoreMLRep, self).run(inputs, **kwargs)
      inputs_ = inputs
      _reshaped = False
      if not SupportedVersion.is_nd_array_supported(
          self.minimum_ios_deployment_target
      ):
          for i, input_ in enumerate(inputs_):
              shape = input_.shape
              if len(shape) == 4 or len(shape) == 2:
                  inputs_[i] = input_[np.newaxis, :]
                  _reshaped = True
              elif len(shape) == 3:
                  spec = self.model.get_spec()
                  spec_shape = [
                      int(k)
                      for k in spec.description.input[
                          i
                      ].type.multiArrayType.shape
                  ]
                  prod = spec_shape[0] * spec_shape[1] * spec_shape[2]
                  onnx_shape = list(shape)
                  if onnx_shape != spec_shape:
                      if onnx_shape[2] == prod:
                          inputs_[i] = np.reshape(
                              inputs_[i],
                              [onnx_shape[0], onnx_shape[1]]
                              + spec_shape,
                          )
                      elif onnx_shape[1] * onnx_shape[2] == prod:
                          inputs_[i] = np.reshape(
                              inputs_[i],
                              [1, onnx_shape[0]] + spec_shape,
                          )
      input_dict = dict(zip(self.input_names, map(np.array, inputs_)))
      _set_dtypes(input_dict, self.model)  # type: ignore
  
      prediction = self.model.predict(input_dict, self.useCPUOnly)
      output_values = [prediction[name] for name in self.output_names]
  
      if not SupportedVersion.is_nd_array_supported(
          self.minimum_ios_deployment_target
      ):
          for i, output_ in enumerate(output_values):
              shape = output_.shape
              # reshape the CoreML output to match Onnx's output shape
              try:
                  output_values[i] = np.reshape(output_, self.onnx_outputs_info[self.output_names[i]][2])  # type: ignore
              except RuntimeError:
                  print(
                      "Output '%s' shape incompatible between CoreML (%s) and onnx (%s)"
                      % (
                          self.output_names[i],
                          output_.shape,
                          self.onnx_outputs_info[self.output_names[i]],
                      )
                  )
  
      ## Type Cast to ONNX expected output types
      for i, output_ in enumerate(output_values):
          output_type = self.onnx_outputs_info[self.output_names[i]][1]
          if (
              TENSOR_TYPE_TO_NP_TYPE[output_type]
              != output_values[i].dtype
          ):
              output_values[i] = output_values[i].astype(
                  TENSOR_TYPE_TO_NP_TYPE[output_type]
              )
  
      result = namedtupledict("Outputs", self.output_names)(
          *output_values
      )  # type: Tuple[Any, ...]
      return result
  
file_path: turicreate/src/external/coremltools_wrap/coremltools/coremltools/converters/onnx/_backend_rep.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  from typing import Any, Sequence, List
  from onnx.backend.base import BackendRep, namedtupledict
  from onnx.mapping import TENSOR_TYPE_TO_NP_TYPE
  from coremltools.proto import FeatureTypes_pb2
  from coremltools.models import MLModel
  from typing import Dict, Any, Text, Tuple
  from onnx import TensorProto
  from ._graph import EdgeInfo
  from ._converter import SupportedVersion
label_desc: Use image node_id 2 for calling the CoreMLRep obj's underlying member method code with example usage: obj.run(inputs) and returns: result