I’ve worked out that for MaxPool1d, grad_input matches the elements of the tensor which are output by the module (i.e. all it is all the non zero gradients of the input).
My follow up question is whether there is a way to manipulate the gradients of the other elements (i.e. the values of grad_in which should be 0, but instead aren’t in grad_in) using the backward hook?