code: def test_dataloader():
      loader = DataLoader(
          MockDataset((32, 32)),
          shuffle=True,
          batch_size=2,
          drop_last=True,
      )
  
      ds_iter = iter(loader)
      num_batches = 0
      for x, y in ds_iter:
          num_batches += 1
      assert len(loader) == 1
      assert num_batches == 1
      assert isinstance(x, tf.Tensor) and isinstance(y, tf.Tensor)
      assert x.shape == (2, 32, 32)
      assert y.shape == (2,)
  
      # Drop last
      loader = DataLoader(
          MockDataset((32, 32)),
          shuffle=True,
          batch_size=2,
          drop_last=False,
      )
      ds_iter = iter(loader)
      num_batches = 0
      for x, y in ds_iter:
          num_batches += 1
      assert loader.num_batches == 2
      assert num_batches == 2
  
      # Custom collate
      loader = DataLoader(
          MockDatasetBis((32, 32)),
          shuffle=True,
          batch_size=2,
          drop_last=False,
      )
  
      ds_iter = iter(loader)
      x, y = next(ds_iter)
      assert isinstance(x, tf.Tensor) and isinstance(y, list)
      assert x.shape == (2, 32, 32)
      assert len(y) == 2
  
file_path: doctr/tests/tensorflow/test_datasets_loader_tf.py
imports: from typing import List, Tuple
  import tensorflow
  from doctr.datasets import DataLoader
label_desc: Use image node_id 1 for calling a global function with example usage: test_dataloader() without return types