I have a tensor like this,

image.png1179×298 5.47 KB

and I want to do convolution operation such that my kernel height is 3 and width is also 3 but kernel moves only in the one direction (in the direction of width). I tried to use 2D convolution with stride 0 for Height but it throws an error as stride should be greater than zero. Any idea how to achieve this in pytorch?
One way could be is to do 1D convolution for each row (1,2,3) and the result of convolution from each row can be put together back in a tensor. Is there any easy way to achieve the same ?