Convolution with all kernel columns same

I want to do a conv1D operation but on an image. Let’s say the data is of size (1,1,H,W). Treat this as a data of size (1,1,H) W times, and do Conv1D(1,1,k) on each and stacking the outputs back. Basically, it is equivalent to doing a Conv2D with kernel size = (k,W), however, with each column of the kernel equal. It is like doing np.tile(kernel,(1,W)) on the regular Conv1D kernel and then using it on the image data.
How can I do this efficiently?

Wouldn’t your approach be equivalent to use a nn.Conv2d with a kernel size of (k, 1)?
This would also only use the height of the kernel and apply it basically to each “column”.
Let me know, if I misunderstood your use case.

1 Like

Oh yeah, I guess that’s an easy way to do it. The difference is, I would need to sum all the columns after the Conv2D operation since I was basically talking about a 2D kernel of size (k,W). But yea, thanks. This pointed me in the right direction!