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: Returns weights from registered layers.
  Returns:
      weights (Python dictionary): a dictionary of the pair
      {layer_name: weight}, where weight is the weight tensor.
docstr_tok: ["Returns","weights","from","registered","layers",".","Returns",":","weights","(","Python","dictionary",")",":","a","dictionary","of","the","pair","{","layer_name",":","weight","}",",","where","weight","is","the","weight","tensor","."]
code: def get_weights(self):
      """
      Returns weights from registered layers.
      Returns:
          weights (Python dictionary): a dictionary of the pair
          {layer_name: weight}, where weight is the weight tensor.
      """
      weights = {}
      for layer in self.layers_names:
          cur_layer = get_layer(self.model, layer)
          if hasattr(cur_layer, "weight"):
              weights[layer] = cur_layer.weight.clone().detach()
          else:
              logger.error(
                  "Layer {} does not have weight attribute.".format(
                      layer
                  )
              )
      return weights
  
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 6 for calling the GetWeightAndActivation obj's underlying member method code with example usage: obj.get_weights() and returns: weights