docstr: Used for benchmarks.
docstr_tok: ["Used","for","benchmarks","."]
code: def raysampler(
      raysampler_type,
      camera_type,
      n_pts_per_ray: int,
      batch_size: int,
      image_width: int,
      image_height: int,
  ) -> Callable[[], None]:
      """
      Used for benchmarks.
      """
      device = torch.device("cuda")
  
      # init raysamplers
      raysampler = TestRaysampling.init_raysampler(
          raysampler_type=raysampler_type,
          min_x=-1.0,
          max_x=1.0,
          min_y=-1.0,
          max_y=1.0,
          image_width=image_width,
          image_height=image_height,
          min_depth=1.0,
          max_depth=10.0,
          n_pts_per_ray=n_pts_per_ray,
      ).to(device)
  
      # init a batch of random cameras
      cameras = init_random_cameras(
          camera_type, batch_size, random_z=True
      ).to(device)
  
      def run_raysampler() -> None:
          raysampler(cameras=cameras)
          torch.cuda.synchronize()
  
      return run_raysampler
  
imports: import unittest
  from typing import Callable
  import torch
  from pytorch3d.common.compat import meshgrid_ij
  from pytorch3d.ops import eyes
  from pytorch3d.renderer import MonteCarloRaysampler, MultinomialRaysampler, NDCGridRaysampler, NDCMultinomialRaysampler
  from pytorch3d.renderer.cameras import FoVOrthographicCameras, FoVPerspectiveCameras, OrthographicCameras, PerspectiveCameras
  from pytorch3d.renderer.implicit.raysampling import _jiggle_within_stratas, _safe_multinomial
  from pytorch3d.renderer.implicit.utils import ray_bundle_to_ray_points, ray_bundle_variables_to_ray_points
  from pytorch3d.transforms import Rotate
  from .common_testing import TestCaseMixin
  from .test_cameras import init_random_cameras
label_desc: Use image node_id 2 for calling the TestRaysampling obj's underlying member method code with example usage: obj.raysampler(raysampler_type, camera_type, n_pts_per_ray, batch_size, image_width, image_height) and returns: run_raysampler