code: def test_multi_fields():
      n_samples = 4096
      shape = (2048,)
  
      with NamedTemporaryFile() as handle:
          name = handle.name
          dataset = TripleDummyActivationsDataset(n_samples, shape)
          writer = DatasetWriter(
              name,
              {
                  "index": IntField(),
                  "activations": NDArrayField(np.dtype("<f4"), shape),
                  "activations2": NDArrayField(np.dtype("<f4"), shape),
                  "activations3": NDArrayField(np.dtype("<f4"), shape),
              },
              num_workers=1,
          )
  
          writer.from_indexed_dataset(dataset)
  
          loader = Loader(
              name, batch_size=3, num_workers=min(5, cpu_count())
          )
          page_size_l2 = int(np.log2(loader.reader.page_size))
          sample_ids = loader.reader.alloc_table["sample_id"]
          pointers = loader.reader.alloc_table["ptr"]
          pages = pointers >> page_size_l2
          sample_to_pages = defaultdict(set)
  
          for sample_id, page in zip(sample_ids, pages):
              sample_to_pages[sample_id].add(page)
              assert_that(sample_to_pages[sample_id]).is_length(1)
  
          for ixes, activations, d2, d3 in loader:
              for ix, activation in zip(ixes, activations):
                  assert_that(
                      np.all(dataset[ix][1] == 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 4 for calling a global function with example usage: test_multi_fields() without return types