code: def get_hanning_kernel1d(
      kernel_size: int,
      device: Optional[Device] = None,
      dtype: Optional[Dtype] = None,
  ) -> Tensor:
      """Returns Hanning (also known as Hann) kernel, used in signal processing and KCF tracker.
  
      .. math::  w(n) = 0.5 - 0.5cos\\left(\\frac{2\\pi{n}}{M-1}\\right)
                 \\qquad 0 \\leq n \\leq M-1
  
      See further in numpy docs https://numpy.org/doc/stable/reference/generated/numpy.hanning.html
  
      Args:
          kernel_size: The size the of the kernel. It should be positive.
          device: tensor device desired to create the kernel
          dtype: tensor dtype desired to create the kernel
  
      Returns:
          1D tensor with Hanning filter coefficients. Shape math:`(\text{kernel_size})`
          .. math::  w(n) = 0.5 - 0.5cos\\left(\\frac{2\\pi{n}}{M-1}\\right)
  
      Examples:
          >>> get_hanning_kernel1d(4)
          tensor([0.0000, 0.7500, 0.7500, 0.0000])
      """
      _check_kernel_size(kernel_size, 2, allow_even=True)
  
      x = torch.arange(kernel_size, device=device, dtype=dtype)
      x = 0.5 - 0.5 * cos(2.0 * math.pi * x / float(kernel_size - 1))
      return x
  
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 38 for calling a global function with example usage: get_hanning_kernel1d(kernel_size, device, dtype) and returns: x