code: def test_recognition_models(arch_name, input_shape, train_mode):
      batch_size = 4
      reco_model = recognition.__dict__[arch_name](
          pretrained=True, input_shape=input_shape
      )
      assert isinstance(reco_model, tf.keras.Model)
      input_tensor = tf.random.uniform(
          shape=[batch_size, *input_shape], minval=0, maxval=1
      )
      target = ["i", "am", "a", "jedi"]
  
      out = reco_model(
          input_tensor,
          target,
          return_model_output=True,
          return_preds=not train_mode,
          training=train_mode,
      )
      assert isinstance(out, dict)
      assert len(out) == 3 if not train_mode else len(out) == 2
      assert isinstance(out["out_map"], tf.Tensor)
      assert out["out_map"].dtype == tf.float32
      if not train_mode:
          assert isinstance(out["preds"], list)
          assert len(out["preds"]) == batch_size
          assert all(
              isinstance(word, str)
              and isinstance(conf, float)
              and 0 <= conf <= 1
              for word, conf in out["preds"]
          )
          assert isinstance(out["loss"], tf.Tensor)
      # test model in train mode needs targets
      with pytest.raises(ValueError):
          reco_model(input_tensor, None, training=True)
  
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 1 for calling a global function with example usage: test_recognition_models(arch_name, input_shape, train_mode) without return types