class_docstr: A class used to get weights and activations from specified layers from a Pytorch model.
class_docstr_tok: ["A","class","used","to","get","weights","and","activations","from","specified","layers","from","a","Pytorch","model","."]
docstr: Args:
      model (nn.Module): the model containing layers to obtain weights and activations from.
      layers (list of strings): a list of layer names to obtain weights and activations from.
          Names are hierarchical, separated by /. For example, If a layer follow a path
          "s1" ---> "pathway0_stem" ---> "conv", the layer path is "s1/pathway0_stem/conv".
docstr_tok: ["Args",":","model","(","nn.Module",")",":","the","model","containing","layers","to","obtain","weights","and","activations","from",".","layers","(","list","of","strings",")",":","a","list","of","layer","names","to","obtain","weights","and","activations","from",".","Names","are","hierarchical",",","separated","by","\/",".","For","example",",","If","a","layer","follow","a","path","``","s1","''","--","-",">","``","pathway0_stem","''","--","-",">","``","conv","''",",","the","layer","path","is","``","s1\/pathway0_stem\/conv","''","."]
code: def __init__(self, model, layers):
      """
      Args:
          model (nn.Module): the model containing layers to obtain weights and activations from.
          layers (list of strings): a list of layer names to obtain weights and activations from.
              Names are hierarchical, separated by /. For example, If a layer follow a path
              "s1" ---> "pathway0_stem" ---> "conv", the layer path is "s1/pathway0_stem/conv".
      """
      self.model = model
      self.hooks = {}
      self.layers_names = layers
      # eval mode
      self.model.eval()
      self._register_hooks()
  
imports: import itertools
  import numpy
  import matplotlib.pyplot
  import torch
  from sklearn.metrics import confusion_matrix
  import slowfast.utils.logging
  from slowfast.datasets.utils import pack_pathway_output, tensor_normalize
label_desc: Use image node_id 1 to create a new GetWeightAndActivation object  with example: obj = GetWeightAndActivation(model, layers)