code: def plot_batch_individually(
      batched_structs: Union[
          List[Struct],
          Struct,
      ],
      *,
      viewpoint_cameras: Optional[CamerasBase] = None,
      ncols: int = 1,
      extend_struct: bool = True,
      subplot_titles: Optional[List[str]] = None,
      **kwargs,
  ):  # pragma: no cover
      """
      This is a higher level plotting function than plot_scene, for plotting
      Cameras, Meshes, Pointclouds, and RayBundle in simple cases. The simplest use
      is to plot a single Cameras, Meshes, Pointclouds, or a RayBundle object,
      where you just pass it in as a one element list. This will plot each batch
      element in a separate subplot.
  
      More generally, you can supply multiple Cameras, Meshes, Pointclouds, or RayBundle
      having the same batch size `n`. In this case, there will be `n` subplots,
      each depicting the corresponding batch element of all the inputs.
  
      In addition, you can include Cameras, Meshes, Pointclouds, or RayBundle of size 1 in
      the input. These will either be rendered in the first subplot
      (if extend_struct is False), or in every subplot.
      RayBundle includes ImplicitronRayBundle and HeterogeneousRaybundle.
  
      Args:
          batched_structs: a list of Cameras, Meshes, Pointclouds and RayBundle to be
              rendered. Each structure's corresponding batch element will be plotted in a
              single subplot, resulting in n subplots for a batch of size n. Every struct
              should either have the same batch size or be of batch size 1. See extend_struct
              and the description above for how batch size 1 structs are handled. Also accepts
              a single Cameras, Meshes, Pointclouds, and RayBundle object, which will have
              each individual element plotted in its own subplot.
          viewpoint_cameras: an instance of a Cameras object providing a location
              to view the plotly plot from. If the batch size is equal
              to the number of subplots, it is a one to one mapping.
              If the batch size is 1, then that viewpoint will be used
              for all the subplots will be viewed from that point.
              Otherwise, the viewpoint_cameras will not be used.
          ncols: the number of subplots per row
          extend_struct: if True, indicates that structs of batch size 1
              should be plotted in every subplot.
          subplot_titles: strings to name each subplot
          **kwargs: keyword arguments which are passed to plot_scene.
              See plot_scene documentation for details.
  
      Example:
  
      ..code-block::python
  
          mesh = ...  # mesh of batch size 2
          point_cloud = ... # point_cloud of batch size 2
          fig = plot_batch_individually([mesh, point_cloud], subplot_titles=["plot1", "plot2"])
          fig.show()
  
          # this is equivalent to the below figure
          fig = plot_scene({
              "plot1": {
                  "trace1-1": mesh[0],
                  "trace1-2": point_cloud[0]
              },
              "plot2":{
                  "trace2-1": mesh[1],
                  "trace2-2": point_cloud[1]
              }
          })
          fig.show()
  
      The above example will render two subplots which each have both a mesh and pointcloud.
      For more examples look at the pytorch3d tutorials at `pytorch3d/docs/tutorials`,
      in particular the files rendered_color_points.ipynb and rendered_textured_meshes.ipynb.
      """
  
      # check that every batch is the same size or is size 1
      if _get_len(batched_structs) == 0:
          msg = "No structs to plot"
          warnings.warn(msg)
          return
      max_size = 0
      if isinstance(batched_structs, list):
          max_size = max(_get_len(s) for s in batched_structs)
          for struct in batched_structs:
              struct_len = _get_len(struct)
              if struct_len not in (1, max_size):
                  msg = "invalid batch size {} provided: {}".format(
                      struct_len, struct
                  )
                  raise ValueError(msg)
      else:
          max_size = _get_len(batched_structs)
  
      if max_size == 0:
          msg = "No data is provided with at least one element"
          raise ValueError(msg)
  
      if subplot_titles:
          if len(subplot_titles) != max_size:
              msg = "invalid number of subplot titles"
              raise ValueError(msg)
  
      # if we are dealing with HeterogeneousRayBundle of ImplicitronRayBundle create
      # first indexes for faster
      first_idxs = None
      if _is_heterogeneous_ray_bundle(batched_structs):
          # pyre-ignore[16]
          cumsum = batched_structs.camera_counts.cumsum(dim=0)
          first_idxs = torch.cat((cumsum.new_zeros((1,)), cumsum))
  
      scene_dictionary = {}
      # construct the scene dictionary
      for scene_num in range(max_size):
          subplot_title = (
              subplot_titles[scene_num]
              if subplot_titles
              else "subplot " + str(scene_num + 1)
          )
          scene_dictionary[subplot_title] = {}
  
          if isinstance(batched_structs, list):
              for i, batched_struct in enumerate(batched_structs):
                  first_idxs = None
                  if _is_heterogeneous_ray_bundle(batched_structs[i]):
                      # pyre-ignore[16]
                      cumsum = batched_struct.camera_counts.cumsum(
                          dim=0
                      )
                      first_idxs = torch.cat(
                          (cumsum.new_zeros((1,)), cumsum)
                      )
                  # check for whether this struct needs to be extended
                  batched_struct_len = _get_len(batched_struct)
                  if i >= batched_struct_len and not extend_struct:
                      continue
                  _add_struct_from_batch(
                      batched_struct,
                      scene_num,
                      subplot_title,
                      scene_dictionary,
                      i + 1,
                      first_idxs=first_idxs,
                  )
          else:  # batched_structs is a single struct
              _add_struct_from_batch(
                  batched_structs,
                  scene_num,
                  subplot_title,
                  scene_dictionary,
                  first_idxs=first_idxs,
              )
  
      return plot_scene(
          scene_dictionary,
          viewpoint_cameras=viewpoint_cameras,
          ncols=ncols,
          **kwargs,
      )
  
imports: import warnings
  from typing import Dict, List, NamedTuple, Optional, Tuple, Union
  import plotly.graph_objects
  import torch
  from plotly.subplots import make_subplots
  from pytorch3d.renderer import HeterogeneousRayBundle, ray_bundle_to_ray_points, RayBundle, TexturesAtlas, TexturesVertex
  from pytorch3d.renderer.camera_utils import camera_to_eye_at_up
  from pytorch3d.renderer.cameras import CamerasBase
  from pytorch3d.structures import join_meshes_as_scene, Meshes, Pointclouds
label_desc: Use image node_id 6 for calling a global function with example usage: plot_batch_individually(batched_structs) and returns: plot_scene