class_docstr: GradCAM class helps create localization maps using the Grad-CAM method for input videos
  and overlap the maps over the input videos as heatmaps.
  https://arxiv.org/pdf/1610.02391.pdf
class_docstr_tok: ["GradCAM","class","helps","create","localization","maps","using","the","Grad-CAM","method","for","input","videos","and","overlap","the","maps","over","the","input","videos","as","heatmaps",".","https",":","\/\/arxiv.org\/pdf\/1610.02391.pdf"]
docstr: Register forward and backward hook to a layer, given layer_name,
  to obtain gradients and activations.
  Args:
      layer_name (str): name of the layer.
docstr_tok: ["Register","forward","and","backward","hook","to","a","layer",",","given","layer_name",",","to","obtain","gradients","and","activations",".","Args",":","layer_name","(","str",")",":","name","of","the","layer","."]
code: def _register_single_hook(self, layer_name):
      """
      Register forward and backward hook to a layer, given layer_name,
      to obtain gradients and activations.
      Args:
          layer_name (str): name of the layer.
      """
  
      def get_gradients(module, grad_input, grad_output):
          self.gradients[layer_name] = grad_output[0].detach()
  
      def get_activations(module, input, output):
          self.activations[layer_name] = output.clone().detach()
  
      target_layer = get_layer(self.model, layer_name=layer_name)
      target_layer.register_forward_hook(get_activations)
      target_layer.register_backward_hook(get_gradients)
  
file_path: SlowFast/slowfast/visualization/gradcam_utils.py
imports: import matplotlib.pyplot
  import torch
  import torch.nn.functional
  import slowfast.datasets.utils
  from slowfast.visualization.utils import get_layer
label_desc: Use image node_id 2 for calling the GradCAM obj's underlying member method code with example usage: obj._register_single_hook(layer_name) without return types