class_docstr: This class provides functionality to store and load activation vectors
  generated for pre-defined neural network layers.
  It also provides functionality to check if activation vectors already
  exist in the manifold and other auxiliary functions.
  
  This class also defines a torch `Dataset`, representing Activation Vectors,
  which enables lazy access to activation vectors and layer stored in the manifold.
class_docstr_tok: ["This","class","provides","functionality","to","store","and","load","activation","vectors","generated","for","pre-defined","neural","network","layers",".","It","also","provides","functionality","to","check","if","activation","vectors","already","exist","in","the","manifold","and","other","auxiliary","functions",".","This","class","also","defines","a","torch","`","Dataset","`",",","representing","Activation","Vectors",",","which","enables","lazy","access","to","activation","vectors","and","layer","stored","in","the","manifold","."]
docstr: Saves the activation vectors `act_tensor` for the
  `layer` under the manifold `path`.
  
  Args:
      path (str): The path where the activation vectors
              for the `layer` are stored.
      model_id (str): The name/version of the model for which layer activations
              are being computed and stored.
      identifier (str or None): An optional identifier for the layer
              activations. Can be used to distinguish between activations for
              different training batches. For example, the identifier could be
              a suffix composed of a train/test label and numerical value, such
              as "-src-abc".
              Additionally, (abc) could be a unique identifying number. For
              example, it is automatically created in
              AV.generate_dataset_activations from batch index.
              It assumes identifier is same for all layers if a list of
              `layers` is provided.
      layers (str or list[str]): The layer(s) for which the activation vectors
              are computed.
      act_tensors (tensor or list of tensor): A batch of activation vectors.
              This must match the dimension of `layers`.
      num_id (str): string representing the batch number for which the activation
              vectors are computed
docstr_tok: ["Saves","the","activation","vectors","`","act_tensor","`","for","the","`","layer","`","under","the","manifold","`","path","`",".","Args",":","path","(","str",")",":","The","path","where","the","activation","vectors","for","the","`","layer","`","are","stored",".","model_id","(","str",")",":","The","name\/version","of","the","model","for","which","layer","activations","are","being","computed","and","stored",".","identifier","(","str","or","None",")",":","An","optional","identifier","for","the","layer","activations",".","Can","be","used","to","distinguish","between","activations","for","different","training","batches",".","For","example",",","the","identifier","could","be","a","suffix","composed","of","a","train\/test","label","and","numerical","value",",","such","as","``","-src-abc","''",".","Additionally",",","(","abc",")","could","be","a","unique","identifying","number",".","For","example",",","it","is","automatically","created","in","AV.generate_dataset_activations","from","batch","index",".","It","assumes","identifier","is","same","for","all","layers","if","a","list","of","`","layers","`","is","provided",".","layers","(","str","or","list","[","str","]",")",":","The","layer","(","s",")","for","which","the","activation","vectors","are","computed",".","act_tensors","(","tensor","or","list","of","tensor",")",":","A","batch","of","activation","vectors",".","This","must","match","the","dimension","of","`","layers","`",".","num_id","(","str",")",":","string","representing","the","batch","number","for","which","the","activation","vectors","are","computed"]
code: def save(
      path: str,
      model_id: str,
      identifier: str,
      layers: Union[str, List[str]],
      act_tensors: Union[Tensor, List[Tensor]],
      num_id: str,
  ) -> None:
      r"""
      Saves the activation vectors `act_tensor` for the
      `layer` under the manifold `path`.
  
      Args:
          path (str): The path where the activation vectors
                  for the `layer` are stored.
          model_id (str): The name/version of the model for which layer activations
                  are being computed and stored.
          identifier (str or None): An optional identifier for the layer
                  activations. Can be used to distinguish between activations for
                  different training batches. For example, the identifier could be
                  a suffix composed of a train/test label and numerical value, such
                  as "-src-abc".
                  Additionally, (abc) could be a unique identifying number. For
                  example, it is automatically created in
                  AV.generate_dataset_activations from batch index.
                  It assumes identifier is same for all layers if a list of
                  `layers` is provided.
          layers (str or list[str]): The layer(s) for which the activation vectors
                  are computed.
          act_tensors (tensor or list of tensor): A batch of activation vectors.
                  This must match the dimension of `layers`.
          num_id (str): string representing the batch number for which the activation
                  vectors are computed
      """
      if isinstance(layers, str):
          layers = [layers]
      if isinstance(act_tensors, Tensor):
          act_tensors = [act_tensors]
  
      if len(layers) != len(act_tensors):
          raise ValueError(
              "The dimension of `layers` and `act_tensors` must match!"
          )
  
      av_dir = AV._assemble_model_dir(path, model_id)
  
      for i, layer in enumerate(layers):
          av_save_fl_path = os.path.join(
              AV._assemble_file_path(av_dir, identifier, layer),
              "%s.pt" % num_id,
          )
  
          layer_dir = os.path.dirname(av_save_fl_path)
          if not os.path.exists(layer_dir):
              os.makedirs(layer_dir)
          torch.save(act_tensors[i], av_save_fl_path)
  
imports: import glob
  import os
  import re
  import warnings
  from typing import Any, List, Optional, Tuple, Union
  import captum._utils.common
  import torch
  from captum.attr import LayerActivation
  from torch import Tensor
  from torch.nn import Module
  from torch.utils.data import DataLoader, Dataset
label_desc: Use image node_id 6 for calling the AV obj's underlying member method code with example usage: obj.save(path, model_id, identifier, layers, act_tensors, num_id) without return types