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.
  
  Differently from `__getitem__`, this will return None if the experience
  has not been (lazily) loaded yet.
  
  :param exp_idx: The ID of the experience.
  :return: The dataset associated to the experience or None if the
      experience has not been loaded yet or if it has been dropped.
docstr_tok: ["Gets","the","dataset","associated","to","an","experience",".","Differently","from","`","__getitem__","`",",","this","will","return","None","if","the","experience","has","not","been","(","lazily",")","loaded","yet",".",":","param","exp_idx",":","The","ID","of","the","experience",".",":","return",":","The","dataset","associated","to","the","experience","or","None","if","the","experience","has","not","been","loaded","yet","or","if","it","has","been","dropped","."]
code: def get_experience_if_loaded(
      self, exp_idx: int
  ) -> Optional[TCLDataset]:
      """
      Gets the dataset associated to an experience.
  
      Differently from `__getitem__`, this will return None if the experience
      has not been (lazily) loaded yet.
  
      :param exp_idx: The ID of the experience.
      :return: The dataset associated to the experience or None if the
          experience has not been loaded yet or if it has been dropped.
      """
      exp_idx = int(exp_idx)  # Handle single element tensors
      if exp_idx >= len(self):
          raise IndexError(
              f"The stream doesn't contain {exp_idx+1}" f"experiences"
          )
  
      return self._loaded_experiences.get(exp_idx, None)
  
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 7 for calling the LazyDatasetSequence obj's underlying member method code with example usage: obj.get_experience_if_loaded(exp_idx) and returns: self