code: def run_compare_tf_keras(
      model,
      input_values,
      use_cpu_only=False,
      frontend_only=False,
      frontend="tensorflow",
      backend="nn_proto",
      atol=1e-04,
      rtol=1e-05,
  ):
      """
      Parameters
      ----------
      model: TensorFlow 2.x model
          TensorFlow 2.x model annotated with @tf.function.
      input_values: list of np.array
          List of input values in the same order as the input signature.
      use_cpu_only: bool
          If true, use CPU only for prediction, otherwise, use GPU also.
      frontend_only: bool
          If true, skip the prediction call, only validate conversion.
      frontend: str
          Frontend to convert from.
      backend: str
          Backend to convert to.
      atol: float
          The absolute tolerance parameter.
      rtol: float
          The relative tolerance parameter.
      """
  
      proto = converter.convert(
          model, source=frontend, convert_to=backend
      ).get_spec()
  
      # assumes conversion preserve the i/o names
      inputs = sorted([str(i.name) for i in proto.description.input])
      outputs = [str(o.name) for o in proto.description.output]
  
      if frontend_only:
          return
  
      # get tf.keras model output as reference and run comparision
      ref = [model(input_values).numpy()]
      expected_outputs = {n: v for n, v in zip(outputs, ref)}
      input_key_values = {n: v for n, v in zip(inputs, input_values)}
      compare_backend(
          proto,
          input_key_values,
          expected_outputs,
          use_cpu_only,
          atol=atol,
          rtol=rtol,
          also_compare_shapes=True,
      )
  
      return proto
  
file_path: turicreate/src/external/coremltools_wrap/coremltools/coremltools/converters/mil/frontend/tensorflow2/test/testing_utils.py
imports: from coremltools.converters.mil.testing_reqs import converter
  import pytest
  from coremltools.converters.mil.frontend.tensorflow.test.testing_utils import get_tf_node_names
  from coremltools.converters.mil.input_types import TensorType
  from coremltools.converters.mil.testing_utils import compare_backend
  from tensorflow.python.framework import dtypes
label_desc: Use image node_id 3 for calling a global function with example usage: run_compare_tf_keras(model, input_values, use_cpu_only, frontend_only, frontend, backend, atol, rtol) and returns: proto