     }
 
 private:
-    cudnnHandle_t cudnn_handle_;
+    CudaDevice& device_;
     const StackVector<int64_t, kMaxNdim> kernel_size_;
     const StackVector<int64_t, kMaxNdim> stride_;
     const StackVector<int64_t, kMaxNdim> pad_;


        cuda_internal::CudnnPoolingDescriptor pool_desc{cudnn_pooling_mode_, CUDNN_NOT_PROPAGATE_NAN, kernel_size_, pad_, stride_};

        CheckCudnnError(cudnnPoolingBackward(
                cudnn_handle_,
                *pool_desc,
                cuda_internal::GetValuePtr<1>(x_.dtype()),
                *y_desc,
                internal::GetRawOffsetData<void>(y_cont),
                *gout_desc,
                internal::GetRawOffsetData<void>(gout_cont),
                *x_desc,
                internal::GetRawOffsetData<void>(x_cont),
                cuda_internal::GetValuePtr<0>(x_.dtype()),
                *gx_desc,
                internal::GetRawOffsetData<void>(gx)));

        return gx;
    }

class CudaMaxPoolForwardBackward : public chainerx::MaxPoolForwardBackward {
public:
    explicit CudaMaxPoolForwardBackward(
            CudaDevice& device,
            const StackVector<int64_t, kMaxNdim>& kernel_size,
            const StackVector<int64_t, kMaxNdim>& stride,
            const StackVector<int64_t, kMaxNdim>& pad,
            bool cover_all)
        : pool_impl_{device, kernel_size, stride, pad, cover_all, CUDNN_POOLING_MAX} {}

    Array Forward(const Array& x) override { return pool_impl_.Forward(x); }

