class_docstr: Warp a patch by depth.
  
  .. math::
      P_{src}^{\{dst\}} = K_{dst} * T_{src}^{\{dst\}}
  
      I_{src} = \\omega(I_{dst}, P_{src}^{\{dst\}}, D_{src})
  
  Args:
      pinholes_dst: the pinhole models for the destination frame.
      height: the height of the image to warp.
      width: the width of the image to warp.
      mode: interpolation mode to calculate output values ``'bilinear'`` | ``'nearest'``.
      padding_mode: padding mode for outside grid values ``'zeros'`` | ``'border'`` | ``'reflection'``.
      align_corners: interpolation flag.
class_docstr_tok: ["Warp","a","patch","by","depth",".","..","math",":",":","P_","{","src","}","^","{","\\","{","dst\\","}","}","=","K_","{","dst","}","*","T_","{","src","}","^","{","\\","{","dst\\","}","}","I_","{","src","}","=","\\\\omega","(","I_","{","dst","}",",","P_","{","src","}","^","{","\\","{","dst\\","}","}",",","D_","{","src","}",")","Args",":","pinholes_dst",":","the","pinhole","models","for","the","destination","frame",".","height",":","the","height","of","the","image","to","warp",".","width",":","the","width","of","the","image","to","warp",".","mode",":","interpolation","mode","to","calculate","output","values","``","'bilinear","'","``","|","``","'nearest","'","``",".","padding_mode",":","padding","mode","for","outside","grid","values","``","'zeros","'","``","|","``","'border","'","``","|","``","'reflection","'","``",".","align_corners",":","interpolation","flag","."]
docstr: Warp a tensor from destination frame to reference given the depth in the reference frame.
  
  Args:
      depth_src: the depth in the reference frame. The tensor must have a shape :math:`(B, 1, H, W)`.
      patch_dst: the patch in the destination frame. The tensor must have a shape :math:`(B, C, H, W)`.
  
  Return:
      the warped patch from destination frame to reference.
  
  Shape:
      - Output: :math:`(N, C, H, W)` where C = number of channels.
  
  Example:
      >>> # pinholes camera models
      >>> pinhole_dst = PinholeCamera(torch.randn(1, 4, 4), torch.randn(1, 4, 4),
      ... torch.tensor([32]), torch.tensor([32]))
      >>> pinhole_src = PinholeCamera(torch.randn(1, 4, 4), torch.randn(1, 4, 4),
      ... torch.tensor([32]), torch.tensor([32]))
      >>> # create the depth warper, compute the projection matrix
      >>> warper = DepthWarper(pinhole_dst, 32, 32)
      >>> _ = warper.compute_projection_matrix(pinhole_src)
      >>> # warp the destination frame to reference by depth
      >>> depth_src = torch.ones(1, 1, 32, 32)  # Nx1xHxW
      >>> image_dst = torch.rand(1, 3, 32, 32)  # NxCxHxW
      >>> image_src = warper(depth_src, image_dst)  # NxCxHxW
docstr_tok: ["Warp","a","tensor","from","destination","frame","to","reference","given","the","depth","in","the","reference","frame",".","Args",":","depth_src",":","the","depth","in","the","reference","frame",".","The","tensor","must","have","a","shape",":","math",":","`","(","B",",","1",",","H",",","W",")","`",".","patch_dst",":","the","patch","in","the","destination","frame",".","The","tensor","must","have","a","shape",":","math",":","`","(","B",",","C",",","H",",","W",")","`",".","Return",":","the","warped","patch","from","destination","frame","to","reference",".","Shape",":","-","Output",":",":","math",":","`","(","N",",","C",",","H",",","W",")","`","where","C","=","number","of","channels",".","Example",":",">",">",">","#","pinholes","camera","models",">",">",">","pinhole_dst","=","PinholeCamera","(","torch.randn","(","1",",","4",",","4",")",",","torch.randn","(","1",",","4",",","4",")",",","...","torch.tensor","(","[","32","]",")",",","torch.tensor","(","[","32","]",")",")",">",">",">","pinhole_src","=","PinholeCamera","(","torch.randn","(","1",",","4",",","4",")",",","torch.randn","(","1",",","4",",","4",")",",","...","torch.tensor","(","[","32","]",")",",","torch.tensor","(","[","32","]",")",")",">",">",">","#","create","the","depth","warper",",","compute","the","projection","matrix",">",">",">","warper","=","DepthWarper","(","pinhole_dst",",","32",",","32",")",">",">",">","_","=","warper.compute_projection_matrix","(","pinhole_src",")",">",">",">","#","warp","the","destination","frame","to","reference","by","depth",">",">",">","depth_src","=","torch.ones","(","1",",","1",",","32",",","32",")","#","Nx1xHxW",">",">",">","image_dst","=","torch.rand","(","1",",","3",",","32",",","32",")","#","NxCxHxW",">",">",">","image_src","=","warper","(","depth_src",",","image_dst",")","#","NxCxHxW"]
code: def forward(self, depth_src: Tensor, patch_dst: Tensor) -> Tensor:
      """Warp a tensor from destination frame to reference given the depth in the reference frame.
  
      Args:
          depth_src: the depth in the reference frame. The tensor must have a shape :math:`(B, 1, H, W)`.
          patch_dst: the patch in the destination frame. The tensor must have a shape :math:`(B, C, H, W)`.
  
      Return:
          the warped patch from destination frame to reference.
  
      Shape:
          - Output: :math:`(N, C, H, W)` where C = number of channels.
  
      Example:
          >>> # pinholes camera models
          >>> pinhole_dst = PinholeCamera(torch.randn(1, 4, 4), torch.randn(1, 4, 4),
          ... torch.tensor([32]), torch.tensor([32]))
          >>> pinhole_src = PinholeCamera(torch.randn(1, 4, 4), torch.randn(1, 4, 4),
          ... torch.tensor([32]), torch.tensor([32]))
          >>> # create the depth warper, compute the projection matrix
          >>> warper = DepthWarper(pinhole_dst, 32, 32)
          >>> _ = warper.compute_projection_matrix(pinhole_src)
          >>> # warp the destination frame to reference by depth
          >>> depth_src = torch.ones(1, 1, 32, 32)  # Nx1xHxW
          >>> image_dst = torch.rand(1, 3, 32, 32)  # NxCxHxW
          >>> image_src = warper(depth_src, image_dst)  # NxCxHxW
      """
      return kornia_ops.map_coordinates(
          patch_dst,
          self.warp_grid(depth_src),
          mode=self.mode,
          padding_mode=self.padding_mode,
          align_corners=self.align_corners,
      )
  
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 7 for calling the DepthWarper obj's underlying member method code with example usage: obj.forward(depth_src, patch_dst) and returns: kornia_ops