# Buggy code
def zoom(
    input, zoom, output=None, order=None, mode="constant", cval=0.0, prefilter=True
):
    """Zoom an array.

    The array is zoomed using spline interpolation of the requested order.

    Args:
        input (cupy.ndarray): The input array.
        zoom (float or sequence): The zoom factor along the axes. If a float,
            ``zoom`` is the same for each axis. If a sequence, ``zoom`` should
            contain one value for each axis.
        output (cupy.ndarray or ~cupy.dtype): The array in which to place the
            output, or the dtype of the returned array.
        order (int): The order of the spline interpolation. If it is not given,
            order 1 is used. It is different from :mod:`scipy.ndimage` and can
            change in the future. Currently it supports only order 0 and 1.
        mode (str): Points outside the boundaries of the input are filled
            according to the given mode (``'constant'``, ``'nearest'``,
            ``'mirror'`` or ``'opencv'``). Default is ``'constant'``.
        cval (scalar): Value used for points outside the boundaries of
            the input if ``mode='constant'`` or ``mode='opencv'``. Default is
            0.0
        prefilter (bool): It is not used yet. It just exists for compatibility
            with :mod:`scipy.ndimage`.

    Returns:
        cupy.ndarray or None:
            The zoomed input.

    .. seealso:: :func:`scipy.ndimage.zoom`
    """

    _check_parameter("zoom", order, mode)

    zoom = _util._fix_sequence_arg(zoom, input.ndim, "zoom", float)

    output_shape = []
    for s, z in zip(input.shape, zoom):
        output_shape.append(int(round(s * z)))
    output_shape = tuple(output_shape)

    if mode == "opencv":
        zoom = []
        offset = []
        for in_size, out_size in zip(input.shape, output_shape):
            if out_size > 1:
                zoom.append(float(in_size) / out_size)
                offset.append((zoom[-1] - 1) / 2.0)
            else:
                zoom.append(0)
                offset.append(0)
        mode = "nearest"

        output = affine_transform(
            input,
            cupy.asarray(zoom),
            offset,
            output_shape,
            output,
            order,
            mode,
            cval,
            prefilter,
        )
    else:
        if order is None:
            order = 1

        zoom = []
        for in_size, out_size in zip(input.shape, output_shape):
            if out_size > 1:
                zoom.append(float(in_size - 1) / (out_size - 1))
            else:
                zoom.append(0)

        output = _util._get_output(output, input, shape=output_shape)
        if input.dtype.kind in "iu":
            input = input.astype(cupy.float32)
        integer_output = output.dtype.kind in "iu"
        large_int = max(_prod(input.shape), _prod(output_shape)) > 1 << 31
        kern = _interp_kernels._get_zoom_kernel(
            input.ndim,
            large_int,
            output_shape,
            mode,
            order=order,
            integer_output=integer_output,
        )
        zoom = cupy.asarray(zoom, dtype=cupy.float64)
        kern(input, zoom, output)
    return output


# Traceback (cupy_backends.cuda.libs.nvrtc.NVRTCError)
/home/croat/.local/share/virtualenvs/starmap-T47byR32/lib/python3.8/site-packages/cupyx/scipy/ndimage/interpolation.py:15: UserWarning: In the current feature the default order of shift is 1. It is different from scipy.ndimage and can change in the future.
warnings.warn('In the current feature the default order of {} is 1. '
Traceback (most recent call last):
File "/home/croat/.local/share/virtualenvs/starmap-T47byR32/lib/python3.8/site-packages/cupy/cuda/compiler.py", line 516, in compile
nvrtc.compileProgram(self.ptr, options)
File "cupy_backends/cuda/libs/nvrtc.pyx", line 108, in cupy_backends.cuda.libs.nvrtc.compileProgram
File "cupy_backends/cuda/libs/nvrtc.pyx", line 120, in cupy_backends.cuda.libs.nvrtc.compileProgram
File "cupy_backends/cuda/libs/nvrtc.pyx", line 58, in cupy_backends.cuda.libs.nvrtc.check_status
cupy_backends.cuda.libs.nvrtc.NVRTCError: NVRTC_ERROR_COMPILATION (6)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/croat/.local/share/virtualenvs/starmap-T47byR32/lib/python3.8/site-packages/cupyx/scipy/ndimage/interpolation.py", line 379, in shift
kern(input, shift, output)
File "cupy/core/_kernel.pyx", line 821, in cupy.core._kernel.ElementwiseKernel.__call__
File "cupy/core/_kernel.pyx", line 846, in cupy.core._kernel.ElementwiseKernel._get_elementwise_kernel
File "cupy/_util.pyx", line 103, in cupy._util.memoize.decorator.ret
File "cupy/core/_kernel.pyx", line 639, in cupy.core._kernel._get_elementwise_kernel
File "cupy/core/_kernel.pyx", line 37, in cupy.core._kernel._get_simple_elementwise_kernel
File "cupy/core/_kernel.pyx", line 60, in cupy.core._kernel._get_simple_elementwise_kernel
File "cupy/core/core.pyx", line 1937, in cupy.core.core.compile_with_cache
File "/home/croat/.local/share/virtualenvs/starmap-T47byR32/lib/python3.8/site-packages/cupy/cuda/compiler.py", line 335, in compile_with_cache
return _compile_with_cache_cuda(
File "/home/croat/.local/share/virtualenvs/starmap-T47byR32/lib/python3.8/site-packages/cupy/cuda/compiler.py", line 402, in _compile_with_cache_cuda
ptx, mapping = compile_using_nvrtc(
File "/home/croat/.local/share/virtualenvs/starmap-T47byR32/lib/python3.8/site-packages/cupy/cuda/compiler.py", line 173, in compile_using_nvrtc
return _compile(source, options, cu_path,
File "/home/croat/.local/share/virtualenvs/starmap-T47byR32/lib/python3.8/site-packages/cupy/cuda/compiler.py", line 157, in _compile
ptx, mapping = prog.compile(options, log_stream)
File "/home/croat/.local/share/virtualenvs/starmap-T47byR32/lib/python3.8/site-packages/cupy/cuda/compiler.py", line 527, in compile
raise CompileException(log, self.src, self.name, options,
cupy.cuda.compiler.CompileException: /tmp/tmpbp6idobr/064ead033e63783c4dfe62433771dbed_2.cubin.cu(28): error: invalid type conversion

/tmp/tmpbp6idobr/064ead033e63783c4dfe62433771dbed_2.cubin.cu(20): warning: variable "s" was declared but never referenced

/tmp/tmpbp6idobr/064ead033e63783c4dfe62433771dbed_2.cubin.cu(20): warning: variable "t" was declared but never referenced

1 error detected in the compilation of "/tmp/tmpbp6idobr/064ead033e63783c4dfe62433771dbed_2.cubin.cu".

# Fixed code
def zoom(
    input, zoom, output=None, order=None, mode="constant", cval=0.0, prefilter=True
):
    """Zoom an array.

    The array is zoomed using spline interpolation of the requested order.

    Args:
        input (cupy.ndarray): The input array.
        zoom (float or sequence): The zoom factor along the axes. If a float,
            ``zoom`` is the same for each axis. If a sequence, ``zoom`` should
            contain one value for each axis.
        output (cupy.ndarray or ~cupy.dtype): The array in which to place the
            output, or the dtype of the returned array.
        order (int): The order of the spline interpolation. If it is not given,
            order 1 is used. It is different from :mod:`scipy.ndimage` and can
            change in the future. Currently it supports only order 0 and 1.
        mode (str): Points outside the boundaries of the input are filled
            according to the given mode (``'constant'``, ``'nearest'``,
            ``'mirror'`` or ``'opencv'``). Default is ``'constant'``.
        cval (scalar): Value used for points outside the boundaries of
            the input if ``mode='constant'`` or ``mode='opencv'``. Default is
            0.0
        prefilter (bool): It is not used yet. It just exists for compatibility
            with :mod:`scipy.ndimage`.

    Returns:
        cupy.ndarray or None:
            The zoomed input.

    .. seealso:: :func:`scipy.ndimage.zoom`
    """

    _check_parameter("zoom", order, mode)

    zoom = _util._fix_sequence_arg(zoom, input.ndim, "zoom", float)

    output_shape = []
    for s, z in zip(input.shape, zoom):
        output_shape.append(int(round(s * z)))
    output_shape = tuple(output_shape)

    if mode == "opencv":
        zoom = []
        offset = []
        for in_size, out_size in zip(input.shape, output_shape):
            if out_size > 1:
                zoom.append(float(in_size) / out_size)
                offset.append((zoom[-1] - 1) / 2.0)
            else:
                zoom.append(0)
                offset.append(0)
        mode = "nearest"

        output = affine_transform(
            input,
            cupy.asarray(zoom),
            offset,
            output_shape,
            output,
            order,
            mode,
            cval,
            prefilter,
        )
    else:
        if order is None:
            order = 1

        zoom = []
        for in_size, out_size in zip(input.shape, output_shape):
            if out_size > 1:
                zoom.append(float(in_size - 1) / (out_size - 1))
            else:
                zoom.append(0)

        output = _util._get_output(output, input, shape=output_shape)
        if input.dtype.kind in "iu":
            input = input.astype(cupy.float32)
        integer_output = output.dtype.kind in "iu"
        _util._check_cval(mode, cval, integer_output)
        large_int = max(_prod(input.shape), _prod(output_shape)) > 1 << 31
        kern = _interp_kernels._get_zoom_kernel(
            input.ndim,
            large_int,
            output_shape,
            mode,
            order=order,
            integer_output=integer_output,
        )
        zoom = cupy.asarray(zoom, dtype=cupy.float64)
        kern(input, zoom, output)
    return output