code: def get_pascal_kernel_1d(
      kernel_size: int,
      norm: bool = False,
      *,
      device: Optional[Device] = None,
      dtype: Optional[Dtype] = None,
  ) -> Tensor:
      """Generate Yang Hui triangle (Pascal's triangle) by a given number.
  
      Args:
          kernel_size: height and width of the kernel.
          norm: if to normalize the kernel or not. Default: False.
          device: tensor device desired to create the kernel
          dtype: tensor dtype desired to create the kernel
  
      Returns:
          kernel shaped as :math:`(kernel_size,)`
  
      Examples:
      >>> get_pascal_kernel_1d(1)
      tensor([1.])
      >>> get_pascal_kernel_1d(2)
      tensor([1., 1.])
      >>> get_pascal_kernel_1d(3)
      tensor([1., 2., 1.])
      >>> get_pascal_kernel_1d(4)
      tensor([1., 3., 3., 1.])
      >>> get_pascal_kernel_1d(5)
      tensor([1., 4., 6., 4., 1.])
      >>> get_pascal_kernel_1d(6)
      tensor([ 1.,  5., 10., 10.,  5.,  1.])
      """
      pre: list[float] = []
      cur: list[float] = []
      for i in range(kernel_size):
          cur = [1.0] * (i + 1)
  
          for j in range(1, i // 2 + 1):
              value = pre[j - 1] + pre[j]
              cur[j] = value
              if i != 2 * j:
                  cur[-j - 1] = value
          pre = cur
  
      out = tensor(cur, device=device, dtype=dtype)
  
      if norm:
          out = out / out.sum()
  
      return out
  
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 35 for calling a global function with example usage: get_pascal_kernel_1d(kernel_size, norm) and returns: out