code: def depth_to_3d_v2(
      depth: Tensor,
      camera_matrix: Tensor,
      normalize_points: bool = False,
      xyz_grid: Optional[Tensor] = None,
  ) -> Tensor:
      # NOTE: when this replaces the `depth_to_3d` behaviour, a deprecated function should be added here, instead
      # of just replace the other function.
      """Compute a 3d point per pixel given its depth value and the camera intrinsics.
  
      .. note::
  
          This is an alternative implementation of :py:func:`kornia.geometry.depth.depth_to_3d`
          that does not require the creation of a meshgrid.
  
      Args:
          depth: image tensor containing a depth value per pixel with shape :math:`(*, H, W)`.
          camera_matrix: tensor containing the camera intrinsics with shape :math:`(*, 3, 3)`.
          normalize_points: whether to normalise the pointcloud. This must be set to `True` when the depth is
            represented as the Euclidean ray length from the camera position.
  
      Return:
          tensor with a 3d point per pixel of the same resolution as the input :math:`(*, H, W, 3)`.
  
      Example:
          >>> depth = torch.rand(4, 4)
          >>> K = torch.eye(3)
          >>> depth_to_3d_v2(depth, K).shape
          torch.Size([4, 4, 3])
      """
      KORNIA_CHECK_SHAPE(depth, ["*", "H", "W"])
      KORNIA_CHECK_SHAPE(camera_matrix, ["*", "3", "3"])
  
      # create base grid if not provided
      height, width = depth.shape[-2:]
      points_xyz: Tensor = xyz_grid or unproject_meshgrid(
          height,
          width,
          camera_matrix,
          normalize_points,
          depth.device,
          depth.dtype,
      )
  
      KORNIA_CHECK_SHAPE(points_xyz, ["*", "H", "W", "3"])
  
      return points_xyz * depth[..., None]
  
imports: from __future__ import annotations
  from typing import Optional
  import torch
  import kornia.core
  from kornia.core import Module, Tensor, tensor
  from kornia.core.check import KORNIA_CHECK, KORNIA_CHECK_IS_TENSOR, KORNIA_CHECK_SHAPE
  from kornia.filters.sobel import spatial_gradient
  from kornia.utils import create_meshgrid
  from kornia.utils.helpers import deprecated
  from .camera import PinholeCamera, cam2pixel, pixel2cam, project_points, unproject_points
  from .conversions import normalize_pixel_coordinates, normalize_points_with_intrinsics
  from .linalg import compose_transformations, convert_points_to_homogeneous, inverse_transformation, transform_points
label_desc: Use image node_id 2 for calling a global function with example usage: depth_to_3d_v2(depth, camera_matrix, normalize_points, xyz_grid) and returns: unknown