code: def unproject_xy_grid_from_ndc_to_world_coord(
      cameras: CamerasBase, xy_grid: torch.Tensor
  ) -> Tuple[torch.Tensor, torch.Tensor]:
      """
  
      Unproject a xy_grid from NDC coordinates to world coordinates.
  
      Args:
          cameras: CamerasBase.
          xy_grid: A tensor of shape `(..., H*W, 2)` representing the
              x, y coords.
  
      Returns:
          A tensor of shape `(..., H*W, 3)` representing the
      """
  
      batch_size = xy_grid.shape[0]
      n_rays_per_image = xy_grid.shape[1:-1].numel()
      xy = xy_grid.view(batch_size, -1, 2)
      xyz = torch.cat(
          [xy, xy_grid.new_ones(batch_size, n_rays_per_image, 1)],
          dim=-1,
      )
      plane_at_depth1 = cameras.unproject_points(xyz, from_ndc=True)
      return plane_at_depth1.view(*xy_grid.shape[:-1], 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 1 for calling a global function with example usage: unproject_xy_grid_from_ndc_to_world_coord(cameras, xy_grid) and returns: plane_at_depth1