def run_compare_torch(
        input_data,
        model,
        expected_results=None,
        atol=1e-04,
        rtol=1e-05,
        input_as_shape=True,
        input_dtype=np.float32,
        backend=("neuralnetwork", "fp32"),
        rand_range=(-1.0, 1.0),
        use_scripting=False,
        converter_input_type=None,
        compute_unit=ct.ComputeUnit.CPU_ONLY,
        minimum_deployment_target=None,
        torch_device=torch.device("cpu"),
        frontend=TorchFrontend.TORCHSCRIPT,
        torch_export_dynamic_shapes=None,
        converter=ct.convert,
    ):
        """
        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.
            converter_input_type: If not None, then pass it to the "inputs" argument to the
                ct.convert() call.
            frontend: TorchFrontend enum
        """
        if minimum_deployment_target is not None:
            validate_minimum_deployment_target(minimum_deployment_target, backend)

        if input_as_shape:
            input_data = generate_input_data(input_data, rand_range, input_dtype, torch_device)

        model_spec = export_torch_model_to_frontend(
            model,
            input_data,
            frontend,
            use_scripting=use_scripting,
            torch_export_dynamic_shapes=torch_export_dynamic_shapes,
        )

        model_spec, mlmodel, coreml_inputs, coreml_results = convert_and_compare(
            input_data,
            model_spec,
            expected_results=expected_results,
            atol=atol,
            rtol=rtol,
            backend=backend,
            converter_input_type=converter_input_type,
            compute_unit=compute_unit,
            minimum_deployment_target=minimum_deployment_target,
            converter=converter,
        )

        return model_spec, mlmodel, coreml_inputs, coreml_results, \
            TorchBaseTest.testclassname, TorchBaseTest.testmodelname

        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.
            converter_input_type: If not None, then pass it to the "inputs" argument to the
                ct.convert() call.
            frontend: TorchFrontend enum
        
coremltools/converters/mil/frontend/torch/test/testing_utils.py