code: def _get_window_grid_kernel2d(
      h: int, w: int, device: torch.device = torch.device("cpu")
  ) -> Tensor:
      r"""Helper function, which generates a kernel to with window coordinates, residual to window center.
  
      Args:
           h: kernel height.
           : kernel width.
           device: device, on which generate.
  
      Returns:
          conv_kernel [2x1xhxw]
      """
      window_grid2d = create_meshgrid(h, w, False, device=device)
      window_grid2d = normalize_pixel_coordinates(window_grid2d, h, w)
      conv_kernel = window_grid2d.permute(3, 0, 1, 2)
      return conv_kernel
  
imports: from __future__ import annotations
  import torch
  import torch.nn.functional
  from kornia.core import Module, Tensor, concatenate, rand, stack, tensor, where, zeros, zeros_like
  from kornia.filters.sobel import spatial_gradient3d
  from kornia.geometry.conversions import normalize_pixel_coordinates, normalize_pixel_coordinates3d
  from kornia.utils import create_meshgrid, create_meshgrid3d
  from kornia.utils._compat import torch_version_ge
  from kornia.utils.helpers import safe_solve_with_mask
  from .dsnt import spatial_expectation2d, spatial_softmax2d
  from .nms import nms3d
label_desc: Use image node_id 1 for calling a global function with example usage: _get_window_grid_kernel2d(h, w, device) and returns: conv_kernel