code: def test_converters():
      """Tests all converters and write output."""
  
      def _exit_if_empty(x, name):
          if not x:
              print(f"WARNING: No {name} found to test! Exiting")
              exit()
  
      def _maybe_reraise(e):
          if _FAIL_ON_ERROR.value:
              raise e
  
      def _format(e):
          # InvalidArgumentError output is shown differently.
          msg = (
              str(e)
              if repr(e).strip() == "InvalidArgumentError()"
              else repr(e)
          )
          msg = msg.replace("\n\n", "\n")  # Output newlines correctly.
          return msg
  
      converters = list(
          filter(lambda x: x.name in _CONVERTERS.value, ALL_CONVERTERS)
      )
      _exit_if_empty(converters, "converters")
  
      harnesses_to_test = {
          name: fn
          for name, fn in ALL_HARNESSES.items()
          if (not _EXAMPLES.value or name in _EXAMPLES.value)
          and (
              not _EXAMPLE_PREFIX.value
              or name.startswith(_EXAMPLE_PREFIX.value)
          )
      }
      _exit_if_empty(harnesses_to_test, "harness")
  
      results = {}
      for name, harness_fn in harnesses_to_test.items():
          harness = harness_fn()  # This will create the variables.
          np_assert_allclose = functools.partial(
              np.testing.assert_allclose, rtol=harness.rtol
          )
          converter_results = []
          for converter in converters:
              print(
                  f"===== Testing example {harness.name}, "
                  f"Converter {converter.name}"
              )
              error_msg = ""
              try:
                  apply_tf = converter.convert_fn(harness)
                  print("=== Conversion OK!")
              except Exception as e:  # pylint: disable=broad-except
                  error_msg = (
                      "Conversion error\n"
                      + _crop_convert_error(repr(e))
                  )
                  print(f"=== {error_msg}")
                  _maybe_reraise(e)
              else:
                  if not converter.compare_numerics:
                      print("=== Skipping numerical comparison.")
                  else:
                      xs = [
                          jax.tree_util.tree_map(_get_random_data, x)
                          for x in harness.inputs
                      ]
                      jax_result = harness.apply_with_vars(*xs)
                      try:
                          tf_result = apply_tf(*xs)
                          jax.tree_map(
                              np_assert_allclose, jax_result, tf_result
                          )
                          print("=== Numerical comparison OK!")
                      except AssertionError as e:
                          error_msg = (
                              "Numerical comparison error:\n"
                              + _format(e)
                          )
                          print("===", error_msg)
                          _maybe_reraise(e)
                      # Catch remaining but expected errors (we still want to fail on
                      # unexpected errors).
                      except (
                          # TFLite runtime error
                          RuntimeError,
                          # TF error
                          tf.errors.InvalidArgumentError,
                          # jax2tf poly shape errors.
                          InconclusiveDimensionOperation,
                          TypeError,
                          IndexError,
                          ValueError,
                      ) as e:
                          error_msg = _format(e)
                          print("=== ", error_msg)
                          _maybe_reraise(e)
  
              converter_results.append((converter.name, error_msg))
          results[harness.name] = converter_results
  
      if _WRITE_MARKDOWN:
          _write_markdown(results)
      else:
          print("=== NOT writing results to Markdown.")
  
file_path: jax/jax/experimental/jax2tf/tests/models_test_main.py
imports: from collections.abc import Sequence
  import datetime
  import functools
  import numpy
  import os
  import re
  import jax
  from absl import app
  from absl import flags
  from jax._src import dtypes
  import tensorflow
  from jax.core import InconclusiveDimensionOperation
  from jax.experimental.jax2tf.tests.model_harness import ALL_HARNESSES
  from jax.experimental.jax2tf.tests.converters import ALL_CONVERTERS
label_desc: Use image node_id 4 for calling a global function with example usage: test_converters() and returns: msg