 class CudaMaxPoolForwardBackward : public chainerx::MaxPoolForwardBackward {
 public:
     explicit CudaMaxPoolForwardBackward(
-            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,
             bool cover_all)
-        : pool_impl_{cudnn_handle, kernel_size, stride, pad, cover_all, CUDNN_POOLING_MAX} {}
+        : pool_impl_{device, kernel_size, stride, pad, cover_all, CUDNN_POOLING_MAX} {}
 
     Array Forward(const Array& x) override { return pool_impl_.Forward(x); }
 

    }

private:
    cudnnHandle_t cudnn_handle_;
    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_};

        {
            std::lock_guard<std::mutex> lock{device_.cudnn_handle_mutex()};
            CheckCudnnError(cudnnPoolingBackward(
                    device_.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;
    }
