class_docstr: Helper class to log information to Tensorboard.
class_docstr_tok: ["Helper","class","to","log","information","to","Tensorboard","."]
docstr: Plot confusion matrices and histograms for eval/test set.
  Args:
      preds (tensor or list of tensors): list of predictions.
      labels (tensor or list of tensors): list of labels.
      global step (Optional[int]): current step in eval/test.
docstr_tok: ["Plot","confusion","matrices","and","histograms","for","eval\/test","set",".","Args",":","preds","(","tensor","or","list","of","tensors",")",":","list","of","predictions",".","labels","(","tensor","or","list","of","tensors",")",":","list","of","labels",".","global","step","(","Optional","[","int","]",")",":","current","step","in","eval\/test","."]
code: def plot_eval(self, preds, labels, global_step=None):
      """
      Plot confusion matrices and histograms for eval/test set.
      Args:
          preds (tensor or list of tensors): list of predictions.
          labels (tensor or list of tensors): list of labels.
          global step (Optional[int]): current step in eval/test.
      """
      if not self.cfg.DETECTION.ENABLE:
          cmtx = None
          if self.cfg.TENSORBOARD.CONFUSION_MATRIX.ENABLE:
              cmtx = vis_utils.get_confusion_matrix(
                  preds, labels, self.cfg.MODEL.NUM_CLASSES
              )
              # Add full confusion matrix.
              add_confusion_matrix(
                  self.writer,
                  cmtx,
                  self.cfg.MODEL.NUM_CLASSES,
                  global_step=global_step,
                  class_names=self.class_names,
                  figsize=self.cm_figsize,
              )
              # If a list of subset is provided, plot confusion matrix subset.
              if self.cm_subset_classes is not None:
                  add_confusion_matrix(
                      self.writer,
                      cmtx,
                      self.cfg.MODEL.NUM_CLASSES,
                      global_step=global_step,
                      subset_ids=self.cm_subset_classes,
                      class_names=self.class_names,
                      tag="Confusion Matrix Subset",
                      figsize=self.cm_figsize,
                  )
              # If a parent-child classes mapping is provided, plot confusion
              # matrices grouped by parent classes.
              if self.parent_map is not None:
                  # Get list of tags (parent categories names) and their children.
                  for (
                      parent_class,
                      children_ls,
                  ) in self.parent_map.items():
                      tag = (
                          "Confusion Matrices Grouped by Parent Classes/"
                          + parent_class
                      )
                      add_confusion_matrix(
                          self.writer,
                          cmtx,
                          self.cfg.MODEL.NUM_CLASSES,
                          global_step=global_step,
                          subset_ids=children_ls,
                          class_names=self.class_names,
                          tag=tag,
                          figsize=self.cm_figsize,
                      )
          if self.cfg.TENSORBOARD.HISTOGRAM.ENABLE:
              if cmtx is None:
                  cmtx = vis_utils.get_confusion_matrix(
                      preds, labels, self.cfg.MODEL.NUM_CLASSES
                  )
              plot_hist(
                  self.writer,
                  cmtx,
                  self.cfg.MODEL.NUM_CLASSES,
                  self.cfg.TENSORBOARD.HISTOGRAM.TOPK,
                  global_step=global_step,
                  subset_ids=self.hist_subset_classes,
                  class_names=self.class_names,
                  figsize=self.hist_figsize,
              )
  
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 3 for calling the TensorboardWriter obj's underlying member method code with example usage: obj.plot_eval(preds, labels, global_step) without return types