Why torch.nn.Conv2d has different result between '(n, n)' and 'n' arguments?
input = torch.randn(8, 3, 50, 100)

m = nn.Conv2d(3, 3, kernel_size=(3, 3), padding=(1, 1))
m2 = nn.Conv2d(3, 3, kernel_size=3, padding=1)

output = m(input)
output2 = m2(input)

torch.equal(output, output2) &gt;&gt; False

I suppose above m and m2 Conv2d should have exactly same output value but practically not, what is the reason?

You have initialized two nn.Conv2d with identical settings, that's true. Initialization of the weights however is done randomly! You have here two different layers m and m2. Namely m.weight and m2.weigth have different components, same goes for m.bias and m2.bias.
One way to have get the same results, is to copy the underlying parameters of the model:
&gt;&gt;&gt; m.weight = m2.weight
&gt;&gt;&gt; m.bias = m2.bias

Which, of course, results in torch.equal(m(input), m2(input)) being True.
