Confused about autograd in Conv2d

Hello,it really made me confused when reading the @SimonW refered source code in AutoGrad about the Conv2d.

When i read the detail of function THNN_(SpatialConvolutionMM_updateGradInput), Could any warm-kinded people tell me the meaning of gradInput, gradOutput and gradColums and the correct order of reading Autograd mechanism used in Conv2d?

Thanks a lot, Really need your help!

1 Like


The argument grad_output is the gradient with respect to the output given by the autograd engine.
grad_input is the tensor where the result should be written.
grad_columns is a temporary buffer given here for efficiency.

The backward functions always take grad_output and return grad_input.

1 Like

Thx a lot! Could i regard the grad_input as δi,l defined below? image

the superscript l reprensents the layer , W is conv2d’s weight kernel and σ(z) has a universal format like

Yes, if you’re in the backward of the layer l,
grad_input = di,l
grad_output = di,l+1

1 Like

I am confused that why gradColumns = weights’ * gradOutput_n ?
Could any help be provided?