code: def _validate_dataset_recognition_part(ds, input_size, batch_size=2):
      # Fetch one sample
      img, label = ds[0]
  
      assert isinstance(img, torch.Tensor)
      assert img.shape == (3, *input_size)
      assert img.dtype == torch.float32
      assert isinstance(label, str)
  
      # Check batching
      loader = DataLoader(
          ds,
          batch_size=batch_size,
          drop_last=True,
          sampler=RandomSampler(ds),
          num_workers=0,
          pin_memory=True,
          collate_fn=ds.collate_fn,
      )
  
      images, labels = next(iter(loader))
      assert isinstance(images, torch.Tensor) and images.shape == (
          batch_size,
          3,
          *input_size,
      )
      assert isinstance(labels, list) and all(
          isinstance(elt, str) for elt in labels
      )
  
imports: import os
  from shutil import move
  import numpy
  import pytest
  import torch
  from torch.utils.data import DataLoader, RandomSampler
  from doctr import datasets
  from doctr.file_utils import CLASS_NAME
  from doctr.transforms import Resize
label_desc: Use image node_id 2 for calling a global function with example usage: _validate_dataset_recognition_part(ds, input_size, batch_size) without return types