code: def _get_ndc_grid(self, h, w, device):
      if w >= h:
          range_x = w / h
          range_y = 1.0
      else:
          range_x = 1.0
          range_y = h / w
  
      half_pix_width = range_x / w
      half_pix_height = range_y / h
  
      min_x = range_x - half_pix_width
      max_x = -range_x + half_pix_width
      min_y = range_y - half_pix_height
      max_y = -range_y + half_pix_height
  
      y_grid, x_grid = meshgrid_ij(
          torch.linspace(min_y, max_y, h, dtype=torch.float32),
          torch.linspace(min_x, max_x, w, dtype=torch.float32),
      )
  
      x_points = x_grid.contiguous().view(-1).to(device)
      y_points = y_grid.contiguous().view(-1).to(device)
      xy = torch.stack((x_points, y_points), dim=1)
      return xy
  
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 3 for calling the TestNDCRaysamplerConvention obj's underlying member method code with example usage: obj._get_ndc_grid(h, w, device) and returns: xy