code: def test_compute_radii(self):
      batch_size = 1
      image_height, image_width = 20, 10
      min_y, max_y, min_x, max_x = -1.0, 1.0, -1.0, 1.0
      y, x = meshgrid_ij(
          torch.linspace(
              min_y, max_y, image_height, dtype=torch.float32
          ),
          torch.linspace(
              min_x, max_x, image_width, dtype=torch.float32
          ),
      )
      xy_grid = torch.stack([x, y], dim=-1).view(-1, 2)
      pixel_width = (max_x - min_x) / (image_width - 1)
      pixel_height = (max_y - min_y) / (image_height - 1)
  
      for cam_type in CAMERA_TYPES:
          # init a batch of random cameras
          cameras = init_random_cameras(
              cam_type, batch_size, random_z=True
          )
          # This method allow us to compute the radii whithout having
          # access to the full grid. Raysamplers during the training
          # will sample random rays from the grid.
          radii = compute_radii(
              cameras, xy_grid, pixel_hw_ndc=(pixel_height, pixel_width)
          )
          plane_at_depth1 = unproject_xy_grid_from_ndc_to_world_coord(
              cameras, xy_grid
          )
          # This method absolutely needs the full grid to work.
          expected_radii = compute_pixel_radii_from_grid(
              plane_at_depth1.reshape(1, image_height, image_width, 3)
          )
          self.assertClose(expected_radii.reshape(-1, 1), radii)
  
imports: import unittest
  from itertools import product
  from typing import Tuple
  from unittest.mock import patch
  import torch
  from pytorch3d.common.compat import meshgrid_ij
  from pytorch3d.implicitron.models.renderer.base import EvaluationMode
  from pytorch3d.implicitron.models.renderer.ray_sampler import AdaptiveRaySampler, compute_radii, NearFarRaySampler
  from pytorch3d.renderer.cameras import CamerasBase, FoVOrthographicCameras, FoVPerspectiveCameras, OrthographicCameras, PerspectiveCameras
  from pytorch3d.renderer.implicit.utils import HeterogeneousRayBundle
  from tests.common_camera_utils import init_random_cameras
  from tests.common_testing import TestCaseMixin
label_desc: Use image node_id 3 for calling the TestRaysampler obj's underlying member method code with example usage: obj.test_compute_radii() without return types