code: def _get_class_indices(self, task):
      class_indices = defaultdict(list)
      if task.num_classes is None:  # Regression task
          class_indices["regression"] = range(len(task))
      else:
          for index in range(len(task)):
              sample = task[index]
              if (not isinstance(sample, tuple)) or (len(sample) < 2):
                  raise ValueError(
                      "In order to split the dataset in train/"
                      "test splits, `Splitter` must access the targets. Each "
                      "sample from a task must be a tuple with at least 2 "
                      "elements, with the last one being the target."
                  )
              class_indices[sample[-1]].append(index)
  
          if len(class_indices) != task.num_classes:
              raise ValueError(
                  "The number of classes detected in `Splitter` "
                  "({0}) is different from the property `num_classes` ({1}) "
                  "in task `{2}`.".format(
                      len(class_indices), task.num_classes, task
                  )
              )
  
      return class_indices
  
imports: import torch
  import numpy
  from collections import OrderedDict, defaultdict
  from torchmeta.utils.data.task import Task, ConcatTask, SubsetTask
  from torchmeta.transforms.utils import apply_wrapper
label_desc: Use image node_id 6 for calling the Splitter obj's underlying member method code with example usage: obj._get_class_indices(task) and returns: class_indices