Hi,
in theory, these should give the same result, but these two layers produced different (but similar) results:
import torch
from torch import nn

b=20
outc = 10
inc = 10
res = 32
input_tensor = torch.randn((b, inc, res, res))
cnn_layer = nn.Conv2d(in_channels=inc, out_channels=outc, kernel_size=res,)
out_cnn_layer = cnn_layer(input_tensor)
fc_layer = nn.Linear(in_features=inc * res * res, out_features=outc)
fc_layer.weight.data = cnn_layer.weight.data.reshape(outc, -1)
fc_layer.bias.data = cnn_layer.bias.data
out_fc_layer = fc_layer(input_tensor.view(b, -1))
assert(torch.allclose(out_cnn_layer.view(b,-1),out_fc_layer))