There are a couple of issues in the code:


the CUDNN_STATUS_BAD_PARAM error is raised, since you are passing padding[0] and padding[1] before the strides, while your conv2d_backward expects the opposite


You are returning an std::tuple of three at::Tensors, while at::cudnn_convolution_backward returns two


output_mask is defined as std::array<bool,2>, while you are passing three bool values