code: def get_hanning_kernel2d(
      kernel_size: tuple[int, int] | int,
      device: Optional[Device] = None,
      dtype: Optional[Dtype] = None,
  ) -> Tensor:
      """Returns 2d Hanning kernel, used in signal processing and KCF tracker.
  
      Args:
          kernel_size: The size of the kernel for the filter. It should be positive.
          device: tensor device desired to create the kernel
          dtype: tensor dtype desired to create the kernel
  
      Returns:
          2D tensor with Hanning filter coefficients. Shape: math:`(\text{kernel_size[0], kernel_size[1]})`
          .. math::  w(n) = 0.5 - 0.5cos\\left(\\frac{2\\pi{n}}{M-1}\\right)
      """
      kernel_size = _unpack_2d_ks(kernel_size)
      _check_kernel_size(kernel_size, 2, allow_even=True)
  
      ky = get_hanning_kernel1d(kernel_size[0], device, dtype)[None].T
      kx = get_hanning_kernel1d(kernel_size[1], device, dtype)[None]
      kernel2d = ky @ kx
  
      return kernel2d
  
imports: from __future__ import annotations
  import math
  from math import sqrt
  from typing import Any, Optional
  import torch
  from kornia.core import Device, Dtype, Tensor, concatenate, cos, stack, tensor, where, zeros, zeros_like
  from kornia.core.check import KORNIA_CHECK, KORNIA_CHECK_IS_TENSOR, KORNIA_CHECK_SHAPE
  from kornia.utils import deprecated
label_desc: Use image node_id 39 for calling a global function with example usage: get_hanning_kernel2d(kernel_size, device, dtype) and returns: kernel2d