code: def fit_one_epoch(
      model, train_loader, batch_transforms, optimizer, amp=False
  ):
      # Iterate over the batches of the dataset
      pbar = tqdm(train_loader, position=1)
      for images, targets in pbar:
          images = batch_transforms(images)
  
          with tf.GradientTape() as tape:
              out = model(images, training=True)
              train_loss = (
                  tf.nn.sparse_softmax_cross_entropy_with_logits(
                      targets, out
                  )
              )
          grads = tape.gradient(train_loss, model.trainable_weights)
          if amp:
              grads = optimizer.get_unscaled_gradients(grads)
          optimizer.apply_gradients(zip(grads, model.trainable_weights))
  
          pbar.set_description(
              f"Training loss: {train_loss.numpy().mean():.6}"
          )
  
file_path: doctr/references/classification/train_tensorflow.py
imports: import os
  import datetime
  import multiprocessing
  import time
  import numpy
  import tensorflow
  from tensorflow.keras import mixed_precision
  from tqdm.auto import tqdm
  from doctr.models import login_to_hub, push_to_hf_hub
  from doctr import transforms
  from doctr.datasets import VOCABS, CharacterGenerator, DataLoader
  from doctr.models import classification
  from doctr.models.utils import export_model_to_onnx
  from utils import EarlyStopper, plot_recorder, plot_samples
label_desc: Use image node_id 2 for calling a global function with example usage: fit_one_epoch(model, train_loader, batch_transforms, optimizer, amp) without return types