class_docstr: A lazily initialized sequence of datasets.
  
  This class provides a way to lazily generate and store the datasets
  linked to each experience. This class uses a generator to get the sequence
  of datasets but it can also be used with a more classic statically
  initialized Sequence (like a list).
  
  This class will also keep track of the targets and task labels field of the
  generated datasets.
docstr: Gets the dataset associated to an experience.
  
  This will load intermediate experiences if needed.
docstr_tok: ["Gets","the","dataset","associated","to","an","experience",".","This","will","load","intermediate","experiences","if","needed","."]
code: def _get_experience_and_load_if_needed(
      self, exp_idx: int
  ) -> TCLDataset:
      """
      Gets the dataset associated to an experience.
  
      This will load intermediate experiences if needed.
      """
  
      exp_idx = int(exp_idx)
      self.load_all_experiences(exp_idx)
      if exp_idx not in self._loaded_experiences:
          raise RuntimeError(f"Experience {exp_idx} has been dropped")
      return self._loaded_experiences[exp_idx]
  
file_path: avalanche/avalanche/benchmarks/scenarios/deprecated/lazy_dataset_sequence.py
imports: from collections import defaultdict
  from typing import Callable, Sequence, Iterable, Dict, Optional, Iterator, TypeVar, Union
  from typing_extensions import overload
  from avalanche.benchmarks.utils.data import AvalancheDataset
  from avalanche.benchmarks.utils.dataset_utils import manage_advanced_indexing
label_desc: Use image node_id 6 for calling the LazyDatasetSequence obj's underlying member method code with example usage: obj._get_experience_and_load_if_needed(exp_idx) and returns: self