code: def pyrdown(
      input: Tensor,
      border_type: str = "reflect",
      align_corners: bool = False,
      factor: float = 2.0,
  ) -> Tensor:
      r"""Blur a tensor and downsamples it.
  
      .. image:: _static/img/pyrdown.png
  
      Args:
          input: the tensor to be downsampled.
          border_type: the padding mode to be applied before convolving.
            The expected modes are: ``'constant'``, ``'reflect'``,
            ``'replicate'`` or ``'circular'``.
          align_corners: interpolation flag.
          factor: the downsampling factor
  
      Return:
          the downsampled tensor.
  
      Examples:
          >>> input = torch.arange(16, dtype=torch.float32).reshape(1, 1, 4, 4)
          >>> pyrdown(input, align_corners=True)
          tensor([[[[ 3.7500,  5.2500],
                    [ 9.7500, 11.2500]]]])
      """
      KORNIA_CHECK_SHAPE(input, ["B", "C", "H", "W"])
  
      kernel: Tensor = _get_pyramid_gaussian_kernel()
      _, _, height, width = input.shape
      # blur image
      x_blur: Tensor = filter2d(input, kernel, border_type)
  
      # TODO: use kornia.geometry.resize/rescale
      # downsample.
      out: Tensor = F.interpolate(
          x_blur,
          size=(
              int(float(height) / factor),
              int(float(width) // factor),
          ),
          mode="bilinear",
          align_corners=align_corners,
      )
      return out
  
imports: from __future__ import annotations
  import math
  import torch
  import torch.nn.functional
  from kornia.core import Module, Tensor, ones, pad, stack, tensor, zeros
  from kornia.core.check import KORNIA_CHECK, KORNIA_CHECK_IS_TENSOR, KORNIA_CHECK_SHAPE
  from kornia.filters import filter2d, gaussian_blur2d
label_desc: Use image node_id 2 for calling a global function with example usage: pyrdown(input, border_type, align_corners, factor) and returns: out