How can i force a 2d convolution to only slide along one direction?

Hi I have an input of shape 2x256 and a convolution layer of shape:

self.conv1 = nn.Conv2d(1, nb_kernels[0], kernel_size = (2,7))

my problem is that i want the kernel to only slide along the columns (the long) dimension and i want therefore the output to be 2x256 again (unchanged)

So usually i would pad, but it does not work for the rows and pyTorch does not allow a stride of 0 in the rows (or columns) direction… how can i achieve this?
I don’t understand why the conv kernel “wants” to slide along the rows since it is 2 and rows are 2… shouldn’t it stay there?
and strangely padding like so : padding=(0, 3) does not work: the output is 1x256 not 2x256 ! I dont understand that…

(P.S: stride=(1, 1), padding=(1, 3) do not work for me since they produce an output of 3x256)

Oh no I m sorry … i think i got my mistake … of course the valid convolution by default produces a 1x256 with a kernel of 2xn … because it just fits in so to speak…
i am tired …sorry for this post.