It seems that the input and output channels are reversed in the definition of the function and when using tensor shape. That is, we have
torch.nn. Conv2d (in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True, padding_mode=‘zeros’ )
if when in_channels=16, and out_channels = 32 (and kernel_size =3) and we call
conv.weight.shape
we get (32, 16, 3, 3).
Is that correct?