class_docstr: Helper class to log information to Tensorboard.
class_docstr_tok: ["Helper","class","to","log","information","to","Tensorboard","."]
docstr: Visualize weights/ activations tensors to Tensorboard.
  Args:
      weight_activation_dict (dict[str, tensor]): a dictionary of the pair {layer_name: tensor},
          where layer_name is a string and tensor is the weights/activations of
          the layer we want to visualize.
      tag (Optional[str]): name of the video.
      normalize (bool): If True, the tensor is normalized. (Default to False)
      global_step(Optional[int]): current step.
      batch_idx (Optional[int]): current batch index to visualize. If None,
          visualize the entire batch.
      indexing_dict (Optional[dict]): a dictionary of the {layer_name: indexing}.
          where indexing is numpy-like fancy indexing.
      heatmap (bool): whether to add heatmap to the weights/ activations.
docstr_tok: ["Visualize","weights\/","activations","tensors","to","Tensorboard",".","Args",":","weight_activation_dict","(","dict","[","str",",","tensor","]",")",":","a","dictionary","of","the","pair","{","layer_name",":","tensor","}",",","where","layer_name","is","a","string","and","tensor","is","the","weights\/activations","of","the","layer","we","want","to","visualize",".","tag","(","Optional","[","str","]",")",":","name","of","the","video",".","normalize","(","bool",")",":","If","True",",","the","tensor","is","normalized",".","(","Default","to","False",")","global_step","(","Optional","[","int","]",")",":","current","step",".","batch_idx","(","Optional","[","int","]",")",":","current","batch","index","to","visualize",".","If","None",",","visualize","the","entire","batch",".","indexing_dict","(","Optional","[","dict","]",")",":","a","dictionary","of","the","{","layer_name",":","indexing","}",".","where","indexing","is","numpy-like","fancy","indexing",".","heatmap","(","bool",")",":","whether","to","add","heatmap","to","the","weights\/","activations","."]
code: def plot_weights_and_activations(
      self,
      weight_activation_dict,
      tag="",
      normalize=False,
      global_step=None,
      batch_idx=None,
      indexing_dict=None,
      heat_map=True,
  ):
      """
      Visualize weights/ activations tensors to Tensorboard.
      Args:
          weight_activation_dict (dict[str, tensor]): a dictionary of the pair {layer_name: tensor},
              where layer_name is a string and tensor is the weights/activations of
              the layer we want to visualize.
          tag (Optional[str]): name of the video.
          normalize (bool): If True, the tensor is normalized. (Default to False)
          global_step(Optional[int]): current step.
          batch_idx (Optional[int]): current batch index to visualize. If None,
              visualize the entire batch.
          indexing_dict (Optional[dict]): a dictionary of the {layer_name: indexing}.
              where indexing is numpy-like fancy indexing.
          heatmap (bool): whether to add heatmap to the weights/ activations.
      """
      for name, array in weight_activation_dict.items():
          if batch_idx is None:
              # Select all items in the batch if batch_idx is not provided.
              batch_idx = list(range(array.shape[0]))
          if indexing_dict is not None:
              fancy_indexing = indexing_dict[name]
              fancy_indexing = (batch_idx,) + fancy_indexing
              array = array[fancy_indexing]
          else:
              array = array[batch_idx]
          add_ndim_array(
              self.writer,
              array,
              tag + name,
              normalize=normalize,
              global_step=global_step,
              heat_map=heat_map,
          )
  
imports: import logging
  import math
  import os
  import matplotlib.pyplot
  import torch
  from torch.utils.tensorboard import SummaryWriter
  from torchvision.utils import make_grid
  import slowfast.utils.logging
  import slowfast.visualization.utils
  from slowfast.utils.misc import get_class_names
label_desc: Use image node_id 5 for calling the TensorboardWriter obj's underlying member method code with example usage: obj.plot_weights_and_activations(weight_activation_dict, tag, normalize, global_step, batch_idx, indexing_dict, heat_map) without return types