Apply filters on gradients of feature maps

My gradients of feature map is of the size: torch.Size([1, 64, 128, 128]). My filters for the corresponding convolutional layer is: torch.Size([64, 3, 5, 5]). How do I multiply these two tensors to get the input: torch.Size([1, 3, 128, 128])?

An example implementation of 2D conv layer using F.unfold() is here: codesmart/ at master · InnovArul/codesmart · GitHub

To answer your question, to get grad_input, try following these lines: