class_docstr: Custom data loader for multiple datasets.
class_docstr_tok: ["Custom","data","loader","for","multiple","datasets","."]
code: def __iter__(self):
      # Adapted from the __iter__ of PyTorch DataLoader:
      # https://pytorch.org/docs/stable/_modules/torch/utils/data/dataloader.html#DataLoader
      # Needed to support 'persistent_workers'
  
      use_persistent_workers = self.loader_kwargs.get(
          "persistent_workers", False
      )
      num_workers = self.loader_kwargs.get("num_workers", 0)
  
      if use_persistent_workers and num_workers > 0:
          if self._persistent_loader is None:
              self._persistent_loader = self._get_loader()
  
          yield from self._persistent_loader
      else:
          yield from self._get_loader()
  
imports: from typing import Any, Dict, Iterator, List, Optional, Sequence, Sized, Union
  import numpy
  from torch.utils.data import DistributedSampler, Dataset
  from torch.utils.data.dataloader import DataLoader
  from avalanche.benchmarks.utils.data import AvalancheDataset
  from avalanche.benchmarks.utils.data_attribute import DataAttribute
  from avalanche.benchmarks.utils.ffcv_support.ffcv_components import HybridFfcvLoader, has_ffcv_support
  from avalanche.distributed.distributed_helper import DistributedHelper
  from torch.utils.data.sampler import Sampler, BatchSampler
  from torch.utils.data import ConcatDataset
label_desc: Use image node_id 2 for calling the MultiDatasetDataLoader obj's underlying member method code with example usage: obj.__iter__() without return types