code: def _kernel_upsample2_downsample2(zeros):
      # Kernel for upsampling and downsampling by a factor of 2. Interestingly,
      # it is the same kernel used for both.
      win = torch.hann_window(4 * zeros + 1, periodic=False)
      winodd = win[1::2]
      t = torch.linspace(-zeros + 0.5, zeros - 0.5, 2 * zeros)
      t *= math.pi
      kernel = (sinc(t) * winodd).view(1, 1, -1)
      return kernel
  
file_path: julius/julius/resample.py
imports: import math
  from typing import Optional
  import torch
  from torch.nn import functional
  from .core import sinc
  from .utils import simple_repr
label_desc: Use image node_id 2 for calling a global function with example usage: _kernel_upsample2_downsample2(zeros) and returns: kernel