class_docstr: A torch Dataset whose __getitem__ returns both a batch of activation vectors,
  as well as a batch of labels associated with those activation vectors.
  It is used to train a classifier in train_tcav
class_docstr_tok: ["A","torch","Dataset","whose","__getitem__","returns","both","a","batch","of","activation","vectors",",","as","well","as","a","batch","of","labels","associated","with","those","activation","vectors",".","It","is","used","to","train","a","classifier","in","train_tcav"]
docstr: Creates the LabelledDataset given a list of K Datasets, and a length K
  list of integer labels representing K different concepts.
  The assumption is that the k-th Dataset of datasets is associated with
  the k-th element of labels.
  The LabelledDataset is the concatenation of the K Datasets in datasets.
  However, __get_item__ not only returns a batch of activation vectors,
  but also a batch of labels indicating which concept that batch of
  activation vectors is associated with.
  
  Args:
  
      datasets (list[Dataset]): The k-th element of datasets is a Dataset
              representing activation vectors associated with the k-th
              concept
      labels (list[int]): The k-th element of labels is the integer label
              associated with the k-th concept
docstr_tok: ["Creates","the","LabelledDataset","given","a","list","of","K","Datasets",",","and","a","length","K","list","of","integer","labels","representing","K","different","concepts",".","The","assumption","is","that","the","k-th","Dataset","of","datasets","is","associated","with","the","k-th","element","of","labels",".","The","LabelledDataset","is","the","concatenation","of","the","K","Datasets","in","datasets",".","However",",","__get_item__","not","only","returns","a","batch","of","activation","vectors",",","but","also","a","batch","of","labels","indicating","which","concept","that","batch","of","activation","vectors","is","associated","with",".","Args",":","datasets","(","list","[","Dataset","]",")",":","The","k-th","element","of","datasets","is","a","Dataset","representing","activation","vectors","associated","with","the","k-th","concept","labels","(","list","[","int","]",")",":","The","k-th","element","of","labels","is","the","integer","label","associated","with","the","k-th","concept"]
code: def __init__(
      self, datasets: List[AV.AVDataset], labels: List[int]
  ) -> None:
      """
      Creates the LabelledDataset given a list of K Datasets, and a length K
      list of integer labels representing K different concepts.
      The assumption is that the k-th Dataset of datasets is associated with
      the k-th element of labels.
      The LabelledDataset is the concatenation of the K Datasets in datasets.
      However, __get_item__ not only returns a batch of activation vectors,
      but also a batch of labels indicating which concept that batch of
      activation vectors is associated with.
  
      Args:
  
          datasets (list[Dataset]): The k-th element of datasets is a Dataset
                  representing activation vectors associated with the k-th
                  concept
          labels (list[int]): The k-th element of labels is the integer label
                  associated with the k-th concept
      """
      assert len(datasets) == len(
          labels
      ), "number of datasets does not match the number of concepts"
  
      from itertools import accumulate
  
      offsets = [0] + list(
          accumulate(map(len, datasets), (lambda x, y: x + y))
      )
      self.length = offsets[-1]
      self.datasets = datasets
      self.labels = labels
      self.lowers = offsets[:-1]
      self.uppers = offsets[1:]
  
imports: from collections import defaultdict
  from typing import Any, cast, Dict, List, Set, Tuple, Union
  import numpy
  import torch
  import torch.multiprocessing
  from captum._utils.av import AV
  from captum._utils.common import _format_tensor_into_tuples, _get_module_from_name
  from captum._utils.typing import TargetType, TensorOrTupleOfTensorsGeneric
  from captum.attr import LayerActivation, LayerAttribution, LayerGradientXActivation
  from captum.concept._core.cav import CAV
  from captum.concept._core.concept import Concept, ConceptInterpreter
  from captum.concept._utils.classifier import Classifier, DefaultClassifier
  from captum.concept._utils.common import concepts_to_str
  from captum.log import log_usage
  from torch import Tensor
  from torch.nn import Module
  from torch.utils.data import DataLoader, Dataset
label_desc: Use image node_id 1 to create a new LabelledDataset object from inherited base classes: Dataset with example: obj = LabelledDataset(datasets, labels)