                     x_indexer,
                     y_indexer,
                     kernel_indexer,
-                    static_cast<int64_t*>(stride.get()),
-                    static_cast<int64_t*>(pad.get()),
+                    CudaStackVector{stride_},
+                    CudaStackVector{pad_},
                     NdimIndex{x_iarray.ndim()});
         });
 

        // Iterate over the kernel in the reverse order, since the resulting index should the be first match.
        for (auto it_kernel = kernel_indexer.It(kernel_indexer.total_size() - 1); it_kernel.raw_index() >= 0; --it_kernel) {
            for (int8_t i = 2; i < x_indexer.ndim(); ++i) {
                int64_t idx = it_y.index()[i] * stride[i - 2] - pad[i - 2] + it_kernel.index()[i - 2];
                idx = max(idx, int64_t{0});
                idx = min(idx, x_indexer.shape()[i] - 1);
                x_index.index()[i] = idx;

#include "xchainer/cuda/cuda_device.h"

#include <algorithm>
#include <cassert>
#include <cstdint>
#include <memory>
