code: def _get_center_kernel3d(
      d: int, h: int, w: int, device: torch.device = torch.device("cpu")
  ) -> Tensor:
      r"""Helper function, which generates a kernel to return center coordinates, when applied with F.conv2d to 3d
      coordinates grid.
  
      Args:
          d: kernel depth.
          h: kernel height.
          w: kernel width.
          device: device, on which generate.
  
      Returns:
          conv_kernel [3x3xdxhxw].
      """
      center_kernel = zeros(3, 3, d, h, w, device=device)
      #  If the size is odd, we have one pixel for center, if even - 2
      if h % 2 != 0:
          h_i1 = h // 2
          h_i2 = (h // 2) + 1
      else:
          h_i1 = (h // 2) - 1
          h_i2 = (h // 2) + 1
      if w % 2 != 0:
          w_i1 = w // 2
          w_i2 = (w // 2) + 1
      else:
          w_i1 = (w // 2) - 1
          w_i2 = (w // 2) + 1
      if d % 2 != 0:
          d_i1 = d // 2
          d_i2 = (d // 2) + 1
      else:
          d_i1 = (d // 2) - 1
          d_i2 = (d // 2) + 1
      center_num = float((h_i2 - h_i1) * (w_i2 - w_i1) * (d_i2 - d_i1))
      center_kernel[
          (0, 1, 2), (0, 1, 2), d_i1:d_i2, h_i1:h_i2, w_i1:w_i2
      ] = (1.0 / center_num)
      return center_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 3 for calling a global function with example usage: _get_center_kernel3d(d, h, w, device) and returns: center_kernel