code: def cameras_points_cartesian_product(
      camera: CamerasBase, pts: torch.Tensor
  ) -> Tuple[CamerasBase, torch.Tensor]:
      """
      Generates all pairs of pairs of elements from 'camera' and 'pts' and returns
      `camera_rep` and `pts_rep` such that::
  
          camera_rep = [                 pts_rep = [
              camera[0]                      pts[0],
              camera[0]                      pts[1],
              camera[0]                      ...,
              ...                            pts[batch_pts-1],
              camera[1]                      pts[0],
              camera[1]                      pts[1],
              camera[1]                      ...,
              ...                            pts[batch_pts-1],
              ...                            ...,
              camera[n_cameras-1]            pts[0],
              camera[n_cameras-1]            pts[1],
              camera[n_cameras-1]            ...,
              ...                            pts[batch_pts-1],
          ]                              ]
  
      Args:
          camera: A batch of `n_cameras` cameras.
          pts: A batch of `batch_pts` points of shape `(batch_pts, ..., dim)`
  
      Returns:
          camera_rep: A batch of batch_pts*n_cameras cameras such that::
  
              camera_rep = [
                  camera[0]
                  camera[0]
                  camera[0]
                  ...
                  camera[1]
                  camera[1]
                  camera[1]
                  ...
                  ...
                  camera[n_cameras-1]
                  camera[n_cameras-1]
                  camera[n_cameras-1]
              ]
  
  
          pts_rep: Repeated `pts` of shape `(batch_pts*n_cameras, ..., dim)`,
              such that::
  
              pts_rep = [
                  pts[0],
                  pts[1],
                  ...,
                  pts[batch_pts-1],
                  pts[0],
                  pts[1],
                  ...,
                  pts[batch_pts-1],
                  ...,
                  pts[0],
                  pts[1],
                  ...,
                  pts[batch_pts-1],
              ]
  
      """
      n_cameras = camera.R.shape[0]
      batch_pts = pts.shape[0]
      pts_rep = pts.repeat(n_cameras, *[1 for _ in pts.shape[1:]])
      idx_cams = (
          torch.arange(n_cameras)[:, None]
          .expand(
              n_cameras,
              batch_pts,
          )
          .reshape(batch_pts * n_cameras)
      )
      # pyre-fixme[6]: For 1st param expected `Union[List[int], int, LongTensor]` but
      #  got `Tensor`.
      camera_rep = camera[idx_cams]
      return camera_rep, pts_rep
  
file_path: pytorch3d/pytorch3d/implicitron/models/view_pooler/view_sampler.py
imports: from typing import Dict, List, Optional, Tuple, Union
  import torch
  from pytorch3d.implicitron.tools.config import Configurable
  from pytorch3d.renderer.cameras import CamerasBase
  from pytorch3d.renderer.utils import ndc_grid_sample
label_desc: Use image node_id 3 for calling a global function with example usage: cameras_points_cartesian_product(camera, pts) and returns: camera_rep,  pts_rep