code: def _vitstr(
      arch: str,
      pretrained: bool,
      backbone_fn,
      input_shape: Optional[Tuple[int, int, int]] = None,
      **kwargs: Any,
  ) -> ViTSTR:
      # Patch the config
      _cfg = deepcopy(default_cfgs[arch])
      _cfg["input_shape"] = input_shape or _cfg["input_shape"]
      _cfg["vocab"] = kwargs.get("vocab", _cfg["vocab"])
      patch_size = kwargs.get("patch_size", (4, 8))
  
      kwargs["vocab"] = _cfg["vocab"]
  
      # Feature extractor
      feat_extractor = backbone_fn(
          # NOTE: we don't use a pretrained backbone for non-rectangular patches to avoid the pos embed mismatch
          pretrained=False,
          input_shape=_cfg["input_shape"],
          patch_size=patch_size,
          include_top=False,
      )
  
      kwargs.pop("patch_size", None)
      kwargs.pop("pretrained_backbone", None)
  
      # Build the model
      model = ViTSTR(feat_extractor, cfg=_cfg, **kwargs)
      # Load pretrained parameters
      if pretrained:
          load_pretrained_params(model, default_cfgs[arch]["url"])
  
      return model
  
file_path: doctr/doctr/models/recognition/vitstr/tensorflow.py
imports: from copy import deepcopy
  from typing import Any, Dict, List, Optional, Tuple
  import tensorflow
  from tensorflow.keras import Model, layers
  from doctr.datasets import VOCABS
  from ...classification import vit_b, vit_s
  from ...utils.tensorflow import _bf16_to_float32, load_pretrained_params
  from .base import _ViTSTR, _ViTSTRPostProcessor
label_desc: Use image node_id 1 for calling a global function with example usage: _vitstr(arch, pretrained, backbone_fn, input_shape) and returns: model