code: def plot_input_normed(
      tensor,
      bboxes=(),
      texts=(),
      path="./tmp_vis.png",
      folder_path="",
      make_grids=False,
      output_video=False,
  ):
      """
      Plot the input tensor with the optional bounding box and save it to disk.
      Args:
          tensor (tensor): a tensor with shape of `NxCxHxW`.
          bboxes (tuple): bounding boxes with format of [[x, y, h, w]].
          texts (tuple): a tuple of string to plot.
          path (str): path to the image to save to.
      """
      tensor = tensor.float()
      try:
          os.mkdir(folder_path)
      except Exception as e:
          pass
      tensor = convert_normalized_images(tensor)
      if output_video:
          # assert make_grids, "video needs to have make_grids on"
          assert tensor.ndim == 5
          sz = tensor.shape
  
          if make_grids:
              vid = tensor.reshape([sz[0], sz[1] * sz[2], sz[3], sz[4]])
              vid = make_grid(vid, padding=8, pad_value=1.0, nrow=sz[0])
              vid = vid.reshape(
                  [sz[1], sz[2], vid.shape[1], vid.shape[2]]
              )
          else:
              vid = tensor.reshape([sz[0] * sz[1], sz[2], sz[3], sz[4]])
  
          vid = vid.permute([0, 2, 3, 1])
          vid *= 255.0
          vid = vid.to(torch.uint8)
          fps = 30.0 * vid.shape[0] / 64.0
          io.video.write_video(path, vid, fps, video_codec="libx264")
      elif make_grids:
          if tensor.ndim > 4 and tensor.shape[0] == 1:
              tensor = tensor.squeeze()
              nrow = 1
          elif tensor.ndim == 5:
              nrow = tensor.shape[1]
              tensor = tensor.reshape(
                  shape=(
                      -1,
                      tensor.shape[2],
                      tensor.shape[3],
                      tensor.shape[4],
                  )
              )
          vis2 = (
              make_grid(tensor, padding=8, pad_value=1.0, nrow=nrow)
              .permute(1, 2, 0)
              .cpu()
              .numpy()
          )
          plt.imsave(fname=path, arr=vis2, format="png")
      else:
          f, ax = plt.subplots(
              nrows=tensor.shape[0],
              ncols=tensor.shape[1],
              figsize=(10 * tensor.shape[1], 10 * tensor.shape[0]),
          )
  
          if tensor.shape[0] == 1:
              for i in range(tensor.shape[1]):
                  ax[i].axis("off")
                  ax[i].imshow(tensor[0][i].permute(1, 2, 0))
                  # ax[1][0].axis('off')
                  if bboxes is not None and len(bboxes) > i:
                      for box in bboxes[i]:
                          x1, y1, x2, y2 = box
                          ax[i].vlines(
                              x1, y1, y2, colors="g", linestyles="solid"
                          )
                          ax[i].vlines(
                              x2, y1, y2, colors="g", linestyles="solid"
                          )
                          ax[i].hlines(
                              y1, x1, x2, colors="g", linestyles="solid"
                          )
                          ax[i].hlines(
                              y2, x1, x2, colors="g", linestyles="solid"
                          )
  
              if texts is not None and len(texts) > i:
                  ax[i].text(0, 0, texts[i])
          else:
              for i in range(tensor.shape[0]):
                  for j in range(tensor.shape[1]):
                      ax[i][j].axis("off")
                      ax[i][j].imshow(tensor[i][j].permute(1, 2, 0))
                      # ax[1][0].axis('off')
                      if bboxes is not None and len(bboxes) > i:
                          for box in bboxes[i]:
                              x1, y1, x2, y2 = box
                              ax[i].vlines(
                                  x1,
                                  y1,
                                  y2,
                                  colors="g",
                                  linestyles="solid",
                              )
                              ax[i].vlines(
                                  x2,
                                  y1,
                                  y2,
                                  colors="g",
                                  linestyles="solid",
                              )
                              ax[i].hlines(
                                  y1,
                                  x1,
                                  x2,
                                  colors="g",
                                  linestyles="solid",
                              )
                              ax[i].hlines(
                                  y2,
                                  x1,
                                  x2,
                                  colors="g",
                                  linestyles="solid",
                              )
  
                      if texts is not None and len(texts) > i:
                          ax[i].text(0, 0, texts[i])
          print(f"{path}")
          f.tight_layout(pad=0.0)
          with pathmgr.open(path, "wb") as h:
              f.savefig(h)
  
imports: import json
  import logging
  import math
  import numpy
  import os
  from datetime import datetime
  import psutil
  import torch
  import torchvision.io
  from fvcore.nn.activation_count import activation_count
  from fvcore.nn.flop_count import flop_count
  from matplotlib import pyplot
  from torch import nn
  from torchvision.utils import make_grid
  import slowfast.utils.logging
  import slowfast.utils.multiprocessing
  from slowfast.datasets.utils import pack_pathway_output
  from slowfast.models.batchnorm_helper import SubBatchNorm3d
  from slowfast.utils.env import pathmgr
label_desc: Use image node_id 10 for calling a global function with example usage: plot_input_normed(tensor, bboxes, texts, path, folder_path, make_grids, output_video) without return types