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: Drop the reference to experiences up to a certain experience ID
  (inclusive).
  
  This means that experiences with ID [0, from_exp] will be released.
  Beware that the associated object will be valid until all the references
  to it are dropped.
  
  :param to_exp: The ID of the last exp to drop (inclusive). If None,
      the whole stream will be loaded. Can be a negative number, in
      which case this method doesn't have any effect. Can be greater
      or equal to the stream length, in which case all currently loaded
      experiences will be dropped.
  :return: None
docstr_tok: ["Drop","the","reference","to","experiences","up","to","a","certain","experience","ID","(","inclusive",")",".","This","means","that","experiences","with","ID","[","0",",","from_exp","]","will","be","released",".","Beware","that","the","associated","object","will","be","valid","until","all","the","references","to","it","are","dropped",".",":","param","to_exp",":","The","ID","of","the","last","exp","to","drop","(","inclusive",")",".","If","None",",","the","whole","stream","will","be","loaded",".","Can","be","a","negative","number",",","in","which","case","this","method","does","n't","have","any","effect",".","Can","be","greater","or","equal","to","the","stream","length",",","in","which","case","all","currently","loaded","experiences","will","be","dropped",".",":","return",":","None"]
code: def drop_previous_experiences(self, to_exp: int) -> None:
      """
      Drop the reference to experiences up to a certain experience ID
      (inclusive).
  
      This means that experiences with ID [0, from_exp] will be released.
      Beware that the associated object will be valid until all the references
      to it are dropped.
  
      :param to_exp: The ID of the last exp to drop (inclusive). If None,
          the whole stream will be loaded. Can be a negative number, in
          which case this method doesn't have any effect. Can be greater
          or equal to the stream length, in which case all currently loaded
          experiences will be dropped.
      :return: None
      """
  
      to_exp = int(to_exp)  # Handle single element tensors
      if to_exp < 0:
          return
  
      to_exp = min(to_exp, len(self) - 1)
  
      for exp_id in range(0, to_exp + 1):
          if exp_id in self._loaded_experiences:
              del self._loaded_experiences[exp_id]
  
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 8 for calling the LazyDatasetSequence obj's underlying member method code with example usage: obj.drop_previous_experiences(to_exp) without return types