code: def run_compare_torch(
      input_data,
      model,
      expected_results=None,
      places=5,
      input_as_shape=True,
      backend="nn_proto",
  ):
      """
      Traces a model and runs a numerical test.
      Args:
          input_as_shape <bool>: If true generates random input data with shape.
          expected_results <iterable, optional>: Expected result from running pytorch model.
      """
      model.eval()
      if input_as_shape:
          input_data = generate_input_data(input_data)
      model_spec = trace_model(model, input_data)
      convert_and_compare(
          input_data,
          model_spec,
          expected_results=expected_results,
          atol=10.0**-places,
          backend=backend,
      )
  
imports: import numpy
  import torch
  import torch.nn
  from six import string_types
  from coremltools import TensorType
  from coremltools.converters.mil.testing_reqs import _converter
  from coremltools.models import MLModel
  from coremltools._deps import _IS_MACOS
label_desc: Use image node_id 6 for calling a global function with example usage: run_compare_torch(input_data, model, expected_results, places, input_as_shape, backend) without return types