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: Visualize the localization maps on their corresponding inputs as heatmap,
  using Grad-CAM.
  Args:
      inputs (list of tensor(s)): the input clips.
      labels (Optional[tensor]): labels of the current input clips.
      alpha (float): transparency level of the heatmap, in the range [0, 1].
  Returns:
      result_ls (list of tensor(s)): the visualized inputs.
      preds (tensor): shape (n_instances, n_class). Model predictions for `inputs`.
docstr_tok: ["Visualize","the","localization","maps","on","their","corresponding","inputs","as","heatmap",",","using","Grad-CAM",".","Args",":","inputs","(","list","of","tensor","(","s",")",")",":","the","input","clips",".","labels","(","Optional","[","tensor","]",")",":","labels","of","the","current","input","clips",".","alpha","(","float",")",":","transparency","level","of","the","heatmap",",","in","the","range","[","0",",","1","]",".","Returns",":","result_ls","(","list","of","tensor","(","s",")",")",":","the","visualized","inputs",".","preds","(","tensor",")",":","shape","(","n_instances",",","n_class",")",".","Model","predictions","for","`","inputs","`","."]
code: def __call__(self, inputs, labels=None, alpha=0.5):
      """
      Visualize the localization maps on their corresponding inputs as heatmap,
      using Grad-CAM.
      Args:
          inputs (list of tensor(s)): the input clips.
          labels (Optional[tensor]): labels of the current input clips.
          alpha (float): transparency level of the heatmap, in the range [0, 1].
      Returns:
          result_ls (list of tensor(s)): the visualized inputs.
          preds (tensor): shape (n_instances, n_class). Model predictions for `inputs`.
      """
      result_ls = []
      localization_maps, preds = self._calculate_localization_map(
          inputs, labels=labels
      )
      for i, localization_map in enumerate(localization_maps):
          # Convert (B, 1, T, H, W) to (B, T, H, W)
          localization_map = localization_map.squeeze(dim=1)
          if localization_map.device != torch.device("cpu"):
              localization_map = localization_map.cpu()
          heatmap = self.colormap(localization_map)
          heatmap = heatmap[:, :, :, :, :3]
          # Permute input from (B, C, T, H, W) to (B, T, H, W, C)
          curr_inp = inputs[i].permute(0, 2, 3, 4, 1)
          if curr_inp.device != torch.device("cpu"):
              curr_inp = curr_inp.cpu()
          curr_inp = data_utils.revert_tensor_normalize(
              curr_inp, self.data_mean, self.data_std
          )
          heatmap = torch.from_numpy(heatmap)
          curr_inp = alpha * heatmap + (1 - alpha) * curr_inp
          # Permute inp to (B, T, C, H, W)
          curr_inp = curr_inp.permute(0, 1, 4, 2, 3)
          result_ls.append(curr_inp)
  
      return result_ls, preds
  
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 5 for calling the GradCAM obj's underlying member method code with example usage: obj.__call__(inputs, labels, alpha) and returns: result_ls,  preds