code: def make_nc_transformation_subset(
      dataset: SupportedDataset,
      transform: Any,
      target_transform: Any,
      classes: Union[None, Sequence[int]],
      bucket_classes: bool = False,
      sort_classes: bool = False,
      sort_indexes: bool = False,
  ) -> TaskAwareClassificationDataset:
      """
      Creates a subset given the list of classes the patterns should belong to.
  
      :param dataset: The original dataset
      :param transform: The transform function for patterns. Can be None.
      :param target_transform: The transform function for targets. Can be None.
      :param classes: A list of classes used to filter the dataset patterns.
          Patterns belonging to one of those classes will be included. If None,
          all patterns will be included.
      :param bucket_classes: If True, the final Dataset will output patterns by
          grouping them by class. Defaults to True.
      :param sort_classes: If ``bucket_classes`` and ``sort_classes`` are both
          True, the final Dataset will output patterns by grouping them by class
          and the class groups will be ordered by class ID (ascending). Ignored
          if ``bucket_classes`` is False. Defaults to False.
      :param sort_indexes: If True, pattern indexes will be sorted (ascending).
          When grouping by class, patterns will be sorted inside their respective
          class buckets. Defaults to False.
  
      :returns: A :class:`TransformationSubset` that includes only patterns
          belonging to the given classes, in the order controlled by the
          ``bucket_classes``, ``sort_classes`` and ``sort_indexes`` parameters.
      """
      return _taskaware_classification_subset(
          dataset,
          indices=_indexes_from_set(
              getattr(dataset, "targets"),
              classes,
              bucket_classes=bucket_classes,
              sort_classes=sort_classes,
              sort_indexes=sort_indexes,
          ),
          transform=transform,
          target_transform=target_transform,
      )
  
file_path: avalanche/avalanche/benchmarks/scenarios/deprecated/new_classes/nc_utils.py
imports: from collections import OrderedDict
  from typing import List, Sequence, Dict, Any, Union, SupportsInt
  import torch
  from avalanche.benchmarks.utils import _taskaware_classification_subset, SupportedDataset
  from avalanche.benchmarks.utils import tensor_as_list
  from avalanche.benchmarks.utils.classification_dataset import TaskAwareClassificationDataset
label_desc: Use image node_id 4 for calling a global function with example usage: make_nc_transformation_subset(dataset, transform, target_transform, classes, bucket_classes, sort_classes, sort_indexes) and returns: _taskaware_classification_subset