docstr: Helper for resampling
docstr_tok: ["Helper","for","resampling"]
code: def __init__(self, h, x_dtype, up, down):
      """Helper for resampling"""
  
      if isinstance(h, cp.ndarray):
          pp = cp
      else:
          pp = np
  
      h = pp.asarray(h)
      if h.ndim != 1 or h.size == 0:
          raise ValueError("h must be 1D with non-zero length")
  
      self._output_type = pp.result_type(h.dtype, x_dtype, pp.float32)
      h = pp.asarray(h, self._output_type)
      self._up = int(up)
      self._down = int(down)
      if self._up < 1 or self._down < 1:
          raise ValueError("Both up and down must be >= 1")
      # This both transposes, and "flips" each phase for filtering
      self._h_trans_flip = _pad_h(h, pp, self._up)
      self._h_trans_flip = cp.asarray(self._h_trans_flip)
      self._h_trans_flip = cp.ascontiguousarray(self._h_trans_flip)
      self._h_len_orig = len(h)
  
imports: from math import ceil
  import cupy
  import numpy
  from ..utils._caches import _cupy_kernel_cache
  from ..utils.helper_tools import _get_function, _get_max_gdx, _get_max_gdy, _get_tpb_bpg, _print_atts
label_desc: Use image node_id 1 to create a new _UpFIRDn object from inherited base classes: object with example: obj = _UpFIRDn(h, x_dtype, up, down)