code: def test_models_onnx_export(arch_name, input_shape):
      # Model
      batch_size = 2
      tf.keras.backend.clear_session()
      model = recognition.__dict__[arch_name](
          pretrained=True, exportable=True, input_shape=input_shape
      )
      # SAR, MASTER, ViTSTR export currently only available with constant batch size
      if arch_name in [
          "sar_resnet31",
          "master",
          "vitstr_small",
          "parseq",
      ]:
          dummy_input = [
              tf.TensorSpec(
                  [batch_size, *input_shape], tf.float32, name="input"
              )
          ]
      else:
          # batch_size = None for dynamic batch size
          dummy_input = [
              tf.TensorSpec(
                  [None, *input_shape], tf.float32, name="input"
              )
          ]
      np_dummy_input = np.random.rand(batch_size, *input_shape).astype(
          np.float32
      )
      with tempfile.TemporaryDirectory() as tmpdir:
          # Export
          model_path, output = export_model_to_onnx(
              model,
              model_name=os.path.join(tmpdir, "model"),
              dummy_input=dummy_input,
              large_model=True if arch_name == "master" else False,
          )
          assert os.path.exists(model_path)
  
          if arch_name == "master":
              # large models are exported as zip archive
              shutil.unpack_archive(model_path, tmpdir, "zip")
              model_path = os.path.join(tmpdir, "__MODEL_PROTO.onnx")
          else:
              model_path = os.path.join(tmpdir, "model.onnx")
  
          # Inference
          ort_session = onnxruntime.InferenceSession(
              model_path, providers=["CPUExecutionProvider"]
          )
          ort_outs = ort_session.run(output, {"input": np_dummy_input})
          assert isinstance(ort_outs, list) and len(ort_outs) == 1
          assert ort_outs[0].shape[0] == batch_size
  
imports: import os
  import shutil
  import tempfile
  import numpy
  import onnxruntime
  import psutil
  import pytest
  import tensorflow
  from doctr.io import DocumentFile
  from doctr.models import recognition
  from doctr.models.preprocessor import PreProcessor
  from doctr.models.recognition.crnn.tensorflow import CTCPostProcessor
  from doctr.models.recognition.master.tensorflow import MASTERPostProcessor
  from doctr.models.recognition.parseq.tensorflow import PARSeqPostProcessor
  from doctr.models.recognition.predictor import RecognitionPredictor
  from doctr.models.recognition.sar.tensorflow import SARPostProcessor
  from doctr.models.recognition.vitstr.tensorflow import ViTSTRPostProcessor
  from doctr.models.utils import export_model_to_onnx
  from doctr.utils.geometry import extract_crops
label_desc: Use image node_id 7 for calling a global function with example usage: test_models_onnx_export(arch_name, input_shape) without return types