In Matlab there is a function called vl_nnconv, which returns either the results of a convolution for a forwards pass or the gradients with respect to the input, filters, and biases depending on the arguments. What is the closest equivalent in PyTorch, especially for the backwards version? I’m extending the Conv2d module in a way that isn’t differentiable (that is, it requires approximations to calculate practical gradients as it uses things like argmax).