code: def test_forward_with_use_bins(self):
      n_rays_per_image = 16
      image_height, image_width = 20, 20
      kwargs = {
          "image_width": image_width,
          "image_height": image_height,
          "n_pts_per_ray_training": 32,
          "n_pts_per_ray_evaluation": 32,
          "n_rays_per_image_sampled_from_mask": n_rays_per_image,
          "cast_ray_bundle_as_cone": True,
      }
  
      batch_size = 1
      samplers = [
          NearFarRaySampler(**kwargs),
          AdaptiveRaySampler(**kwargs),
      ]
      evaluation_modes = [
          EvaluationMode.TRAINING,
          EvaluationMode.EVALUATION,
      ]
      for cam_type, sampler, evaluation_mode in product(
          CAMERA_TYPES, samplers, evaluation_modes
      ):
          cameras = init_random_cameras(
              cam_type, batch_size, random_z=True
          )
          ray_bundle = sampler(cameras, evaluation_mode)
  
          lengths = 0.5 * (
              ray_bundle.bins[..., :-1] + ray_bundle.bins[..., 1:]
          )
  
          self.assertClose(ray_bundle.lengths, lengths)
          shape_out = (
              (batch_size, image_width, image_height)
              if evaluation_mode == EvaluationMode.EVALUATION
              else (batch_size, n_rays_per_image, 1)
          )
          self.assertEqual(
              ray_bundle.pixel_radii_2d.shape, (*shape_out, 1)
          )
          self.assertEqual(ray_bundle.directions.shape, (*shape_out, 3))
          self.assertEqual(ray_bundle.origins.shape, (*shape_out, 3))
  
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 5 for calling the TestRaysampler obj's underlying member method code with example usage: obj.test_forward_with_use_bins() without return types