Not exactly… I want the resulting feature map to be the same spatial size as the filter, not the input. And I only have ONE (k*k*c) filter.
Say we have the filter of (k*k*c), then for each sliding window. We first take element-wise product between the filter and a (k*k*c) region in the input feature map.
Then, we only sum over the channel, which result in a (k*k) matrix (while in the real convolution, we do both spatial and channel summation, resulting in just a single value).
Next, we move the filter to the next (k*k*c) region in the input feature map, getting another (k*k) matrix.
This procedure goes on till the sliding window covers all the input feature map. We concatenate all the resulting (k*k) matrices to be a (k*k*N) tensor, where N is the number of sliding windows.
Is this doable in current PyTorch framework?
Thank you!