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: Loads lazily the activation vectors for given `model_id` and
  `layer` saved under the `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.
      layer (str or None): The layer for which the activation vectors
          are computed.
      num_id (str): An optional string representing the batch number for which
              the activation vectors are computed
  
  Returns:
      dataset (AV.AVDataset): AV.AVDataset that allows to iterate
              over the activation vectors for given layer, identifier (if
              provided), num_id (if provided).  Returning an AV.AVDataset as
              opposed to a DataLoader constructed from it offers more
              flexibility.  Raises RuntimeError if activation vectors are not
              found.
docstr_tok: ["Loads","lazily","the","activation","vectors","for","given","`","model_id","`","and","`","layer","`","saved","under","the","`","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",".","layer","(","str","or","None",")",":","The","layer","for","which","the","activation","vectors","are","computed",".","num_id","(","str",")",":","An","optional","string","representing","the","batch","number","for","which","the","activation","vectors","are","computed","Returns",":","dataset","(","AV.AVDataset",")",":","AV.AVDataset","that","allows","to","iterate","over","the","activation","vectors","for","given","layer",",","identifier","(","if","provided",")",",","num_id","(","if","provided",")",".","Returning","an","AV.AVDataset","as","opposed","to","a","DataLoader","constructed","from","it","offers","more","flexibility",".","Raises","RuntimeError","if","activation","vectors","are","not","found","."]
code: def load(
      path: str,
      model_id: str,
      identifier: Optional[str] = None,
      layer: Optional[str] = None,
      num_id: Optional[str] = None,
  ) -> AVDataset:
      r"""
      Loads lazily the activation vectors for given `model_id` and
      `layer` saved under the `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.
          layer (str or None): The layer for which the activation vectors
              are computed.
          num_id (str): An optional string representing the batch number for which
                  the activation vectors are computed
  
      Returns:
          dataset (AV.AVDataset): AV.AVDataset that allows to iterate
                  over the activation vectors for given layer, identifier (if
                  provided), num_id (if provided).  Returning an AV.AVDataset as
                  opposed to a DataLoader constructed from it offers more
                  flexibility.  Raises RuntimeError if activation vectors are not
                  found.
      """
  
      av_save_dir = AV._assemble_model_dir(path, model_id)
  
      if os.path.exists(av_save_dir):
          avdataset = AV.AVDataset(
              path, model_id, identifier, layer, num_id
          )
          return avdataset
      else:
          raise RuntimeError(
              f"Activation vectors for model {model_id} was not found at path {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 7 for calling the AV obj's underlying member method code with example usage: obj.load(path, model_id, identifier, layer, num_id) and returns: avdataset