'Obtaining a specific shape using nn.Conv2d

Starting with an input shape like (64, 1, 103, 8) how should I set the parameters of nn.Conv2d to arrive at a shape of (64, 32, 43, 8)?

Currently I'm using the following

nn.Conv2d(in_channels=1,out_channels=32, stride=(2,1),kernel_size=(3,3),padding=(0,1),dilation=(9,1))

But I'm afraid that dilation parameter may cause bad performance.



Solution 1:[1]

You can use padding = (13, 1), stride = (3, 1) and kernel_size = 3:

nn.Conv2d(1, 32, 3, stride = (3, 1), padding = (13, 1))

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 saleh sargolzaee