code: def run_test(n_samples, shape, is_ch=False):
      with NamedTemporaryFile() as handle:
          name = handle.name
          dataset = DummyActivationsDataset(n_samples, shape, is_ch)
  
          if is_ch:
              field = TorchTensorField(ch.float32, shape)
          else:
              field = NDArrayField(np.dtype("<f4"), shape)
  
          writer = DatasetWriter(
              name,
              {"index": IntField(), "activations": field},
              num_workers=3,
          )
  
          writer.from_indexed_dataset(dataset)
  
          loader = Loader(
              name, batch_size=3, num_workers=min(5, cpu_count())
          )
          for ixes, activations in loader:
              for ix, activation in zip(ixes, activations):
                  d = dataset[ix][1]
                  if is_ch:
                      d = d.numpy()
                  assert_that(np.all(d == activation.numpy())).is_true()
  
imports: from ctypes import pointer
  from tempfile import NamedTemporaryFile
  from collections import defaultdict
  from assertpy.assertpy import assert_that
  from multiprocessing import cpu_count
  import torch
  from assertpy import assert_that
  import numpy
  from torch.utils.data import Dataset
  from ffcv import DatasetWriter
  from ffcv.fields import IntField, NDArrayField, TorchTensorField
  from ffcv import Loader
label_desc: Use image node_id 1 for calling a global function with example usage: run_test(n_samples, shape, is_ch) without return types