The “torch.nn.grad” package (https://github.com/pytorch/pytorch/blob/master/torch/nn/grad.py) contains functions to manually compute backwards through a convolution operation. It is unclear why it has this name but only contains this for convolutions; I was not able to find documentation for this package or these functions. My question is, is there any similar Python interface for other operations, for instance F.max_pool2d? (It is quite simple to compute the gradient backward through max pooling. But I believe I remember finding this exact backward function somewhere in PyTorch just a few days ago, but I cannot for the life of me remember where, which is why I ask about this specifically.)
Bump.
There is a max_pool2d_with_indices_backward
in L5188 of native_functions.yaml
https://github.com/pytorch/pytorch/blob/master/aten/src/ATen/native/native_functions.yaml#L5188
and L1145 & L1282 of derivatives.yaml
https://github.com/pytorch/pytorch/blob/master/tools/autograd/derivatives.yaml#L1145-L1282
“Life of a Tensor” pytorch wiki seems to imply that all the functions listed in native_functions.yaml
could be used as python functions:
https://github.com/pytorch/pytorch/wiki/Life-of-a-Tensor
I have no idea how to directly call max_pool2d_with_indices_backward
via pytorch’s python frontend though.
How can I call max_pool2d_with_indices_backward
(and all the other *_backward
functions) via pytorch’s python frontend (without using torch.Tensor.backward
or torch.autograd.backward
)?