code: def tensor_as_list(sequence) -> List:
      # Numpy: list(np.array([1, 2, 3])) returns [1, 2, 3]
      # whereas: list(torch.tensor([1, 2, 3])) returns ->
      # -> [tensor(1), tensor(2), tensor(3)]
      #
      # This is why we have to handle Tensor in a different way
      if isinstance(sequence, list):
          return sequence
      if not isinstance(sequence, Iterable):
          return [sequence]
      if isinstance(sequence, Tensor):
          return sequence.tolist()
      return list(sequence)
  
imports: from collections import OrderedDict, defaultdict, deque
  from typing import TYPE_CHECKING, Any, Callable, Generic, Iterator, List, Iterable, Mapping, Optional, Sequence, TypeVar, Union, Dict, SupportsInt
  import warnings
  import torch
  from torch import Tensor
  from torch.utils.data import Subset, ConcatDataset
  from .data import AvalancheDataset
  from .data_attribute import DataAttribute
  from .dataset_definitions import ISupportedClassificationDataset
  from .dataset_utils import SubSequence, find_list_from_index
  from .flat_data import ConstantSequence
  from .transform_groups import TransformGroupDef, TransformGroups, XTransform, YTransform
label_desc: Use image node_id 1 for calling a global function with example usage: tensor_as_list(sequence) and returns: list, sequence, list, sequence