code: def __init__(
      self, loader: "_CustomLoader", batches: Sequence[List[int]]
  ):
      Thread.__init__(self, daemon=True)
      self.loader: "_CustomLoader" = loader
      self.metadata = loader.reader.metadata
      self.current_batch_slot = 0
      self.batches = batches
      self.iter_ixes = iter(batches)
      self.closed = False
      self.output_queue = _QueueWithIndex(self.loader.batches_ahead)
      self.terminate_event = Event()
      self.memory_context = self.loader.memory_manager.schedule_epoch(
          batches
      )
  
      if IS_CUDA:
          self.current_stream = torch.cuda.current_stream()
  
      try:
          self.memory_context.__enter__()
      except MemoryError as e:
          if not isinstance(loader.traversal_order, QuasiRandom):
              print(QUASIRANDOM_ERROR_MSG)
              print("Full error below:")
  
          raise e
  
      self.storage_state = self.memory_context.state
  
      self.cuda_streams = [
          (torch.cuda.Stream() if IS_CUDA else None)
          for _ in range(self.loader.batches_ahead + 2)
      ]
  
      max_batch_size = max(map(len, batches), default=0)
  
      self.memory_allocations = self.loader.graph.allocate_memory(
          max_batch_size, self.loader.batches_ahead + 2
      )
  
      self.start()
  
file_path: avalanche/avalanche/benchmarks/utils/ffcv_support/ffcv_epoch_iterator.py
imports: from threading import Thread, Event, Lock
  from queue import Queue
  from typing import List, Sequence, TYPE_CHECKING
  from ffcv.traversal_order.quasi_random import QuasiRandom
  from ffcv.loader.epoch_iterator import EpochIterator, QUASIRANDOM_ERROR_MSG
  import torch
label_desc: Use image node_id 1 to create a new _CustomEpochIterator object from inherited base classes: FFCVEpochIterator, Thread with example: obj = _CustomEpochIterator(loader, batches)