Hi everyone!
I am wondering, why these outputs are different…
my_data = torch.tensor([1,2,3], dtype=torch.float32).repeat(1000, 1)
weights = torch.rand((3,2))
out = torch.matmul(my_data, weights)
print(out)

linear = nn.Linear(3, 2)
output_linear = linear(my_data)
print(output_linear)

out is not close to output_linear…

image1310×483 12.3 KB

I would like to recreate following schema and I think my torch.matmul multiplies it correctly… but dont know why nn.Linear gives my different results just…