code: def get_gaussian_kernel2d(
      kernel_size: tuple[int, int] | int,
      sigma: tuple[float, float] | Tensor,
      force_even: bool = False,
      *,
      device: Optional[Device] = None,
      dtype: Optional[Dtype] = None,
  ) -> Tensor:
      r"""Function that returns Gaussian filter matrix coefficients.
  
      Args:
          kernel_size: filter sizes in the y and x direction. Sizes should be odd and positive.
          sigma: gaussian standard deviation in the y and x.
          force_even: overrides requirement for odd kernel size.
          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:
          2D tensor with gaussian filter matrix coefficients.
  
      Shape:
          - Output: :math:`(B, \text{kernel_size}_x, \text{kernel_size}_y)`
  
      Examples:
          >>> get_gaussian_kernel2d((5, 5), (1.5, 1.5))
          tensor([[[0.0144, 0.0281, 0.0351, 0.0281, 0.0144],
                   [0.0281, 0.0547, 0.0683, 0.0547, 0.0281],
                   [0.0351, 0.0683, 0.0853, 0.0683, 0.0351],
                   [0.0281, 0.0547, 0.0683, 0.0547, 0.0281],
                   [0.0144, 0.0281, 0.0351, 0.0281, 0.0144]]])
          >>> get_gaussian_kernel2d((3, 5), (1.5, 1.5))
          tensor([[[0.0370, 0.0720, 0.0899, 0.0720, 0.0370],
                   [0.0462, 0.0899, 0.1123, 0.0899, 0.0462],
                   [0.0370, 0.0720, 0.0899, 0.0720, 0.0370]]])
          >>> get_gaussian_kernel2d((5, 5), torch.tensor([[1.5, 1.5]]))
          tensor([[[0.0144, 0.0281, 0.0351, 0.0281, 0.0144],
                   [0.0281, 0.0547, 0.0683, 0.0547, 0.0281],
                   [0.0351, 0.0683, 0.0853, 0.0683, 0.0351],
                   [0.0281, 0.0547, 0.0683, 0.0547, 0.0281],
                   [0.0144, 0.0281, 0.0351, 0.0281, 0.0144]]])
      """
      if isinstance(sigma, tuple):
          sigma = tensor([sigma], device=device, dtype=dtype)
  
      KORNIA_CHECK_IS_TENSOR(sigma)
      KORNIA_CHECK_SHAPE(sigma, ["B", "2"])
  
      ksize_y, ksize_x = _unpack_2d_ks(kernel_size)
      sigma_y, sigma_x = sigma[:, 0, None], sigma[:, 1, None]
  
      kernel_y = get_gaussian_kernel1d(
          ksize_y, sigma_y, force_even, device=device, dtype=dtype
      )[..., None]
      kernel_x = get_gaussian_kernel1d(
          ksize_x, sigma_x, force_even, device=device, dtype=dtype
      )[..., None]
  
      return kernel_y * kernel_x.view(-1, 1, ksize_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 30 for calling a global function with example usage: get_gaussian_kernel2d(kernel_size, sigma, force_even) and returns: unknown