code: def gaussian_discrete(
      window_size: int,
      sigma: Tensor | float,
      *,
      device: Optional[Device] = None,
      dtype: Optional[Dtype] = None,
  ) -> Tensor:
      r"""Discrete Gaussian kernel based on the modified Bessel functions.
  
      Adapted from: https://github.com/Project-MONAI/MONAI/blob/master/monai/networks/layers/convutils.py
      Args:
          window_size: the size which drives the filter amount.
          sigma: gaussian standard deviation. If a tensor, should be in a shape :math:`(B, 1)`
          device: This value will be used if sigma is a float. Device desired to compute.
          dtype: This value will be used if sigma is a float. Dtype desired for compute.
      Returns:
          A tensor withshape :math:`(B, \text{kernel_size})`, with discrete Gaussian values computed by modified Bessel
          function.
      """
      if isinstance(sigma, float):
          sigma = tensor([[sigma]], device=device, dtype=dtype)
  
      KORNIA_CHECK_SHAPE(sigma, ["B", "1"])
  
      sigma2 = sigma * sigma
      tail = int(window_size // 2) + 1
      bessels = [
          _modified_bessel_0(sigma2),
          _modified_bessel_1(sigma2),
          *(_modified_bessel_i(k, sigma2) for k in range(2, tail)),
      ]
      # NOTE: on monain is exp(-sig)
      # https://github.com/Project-MONAI/MONAI/blob/dev/monai/networks/layers/convutils.py#L128
      out = concatenate(bessels[:0:-1] + bessels, -1) * sigma2.exp()
  
      return out / out.sum(-1, keepdim=True)
  
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 10 for calling a global function with example usage: gaussian_discrete(window_size, sigma) and returns: unknown