class_docstr: Base class for all streams connected to a :class:`DatasetScenario`.
  
  This class includes proper typing for the `benchmark` field and
  the `drop_previous_experiences` method, which can be used to drop
  references to already processed datasets.
docstr: Drop the reference to experiences up to a certain experience ID
  (inclusive).
  
  This means that any reference to experiences with ID [0, from_exp] will
  be released. By dropping the reference to previous experiences, the
  memory associated with them can be freed, especially the one occupied
  by the dataset. However, if external references to the experience or
  the dataset still exist, dropping previous experiences at the stream
  level will have little to no impact on the memory usage.
  
  To make sure that the underlying dataset can be freed, make sure that:
  - No reference to previous datasets or experiences are kept in your
      code;
  - The replay implementation doesn't keep a reference to previous
      datasets (in which case, is better to store a copy of the raw
      tensors instead);
  - The benchmark is being generated using a lazy initializer.
  
  By dropping previous experiences, those experiences will no longer be
  available in the stream. Trying to access them will result in an
  exception.
  
  :param to_exp: The ID of the last exp to drop (inclusive). 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
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 any reference to experiences with ID [0, from_exp] will
      be released. By dropping the reference to previous experiences, the
      memory associated with them can be freed, especially the one occupied
      by the dataset. However, if external references to the experience or
      the dataset still exist, dropping previous experiences at the stream
      level will have little to no impact on the memory usage.
  
      To make sure that the underlying dataset can be freed, make sure that:
      - No reference to previous datasets or experiences are kept in your
          code;
      - The replay implementation doesn't keep a reference to previous
          datasets (in which case, is better to store a copy of the raw
          tensors instead);
      - The benchmark is being generated using a lazy initializer.
  
      By dropping previous experiences, those experiences will no longer be
      available in the stream. Trying to access them will result in an
      exception.
  
      :param to_exp: The ID of the last exp to drop (inclusive). 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
      """
      self.benchmark.stream_definitions[
          self.name
      ].exps_data.drop_previous_experiences(to_exp)
  
imports: from abc import ABC, abstractmethod
  from dataclasses import dataclass
  import re
  from typing import Generic, TypeVar, Union, Sequence, Callable, Optional, Dict, Any, Iterable, List, Set, Tuple, Mapping, TYPE_CHECKING
  from .None import DatasetExperience
  from ..generic_scenario import CLScenario, CLExperience, CLStream, SequenceCLStream
  from .lazy_dataset_sequence import LazyDatasetSequence
  from avalanche.benchmarks.utils import AvalancheDataset
  from torch.utils.data.dataset import Dataset
label_desc: Use image node_id 2 for calling the DatasetStream obj's underlying member method code with example usage: obj.drop_previous_experiences(to_exp) without return types