Convolution backpropagation in custom C++ backward() function

Hi everybody!
I am trying to write a C++ extension for Pytorch implementing a Convolutional LSTM. As I understood reading the documentation I have to write the backward() function myself. Starting from this tutorial I made the necessary modifications to the C++ code, but I have problems figuring out how to compute the backpropagation for the convolutional layers. I opened the C++ API documentation looking for a function that could compute the backprop for me and I found the function


that judging by the name it should be what I was looking for, but the documentation is missing.
I was wandering: is it the right function to compute 2D convolution backprop? If not, which is the right function?

You could try your luck with that function, but note that is considered internal to PyTorch (so e.g. people might decide to drop the current function when refactoring bits of PyTorch). You can look at tools/autograd/derivatives.yaml for how it is called when a backward for _thnn_conv2d_forward is needed.

Best regards


Thanks tom for your reply! I figured out how to write a 2D convolution backward() function myself. I guess it is safer than using an internal function, although less efficient.