Hi,
This maybe a naive question to ask but i am a beginner in pytorch and i am unable to figure out how pytorch is doing the forward propagation.
The code i am using is shown below-
class MyModel(nn.Module):
    def __init__(self):
        super(MyModel, self).__init__()
        self.cl1 = nn.Linear(5, 4)
        self.cl2 = nn.Linear(4, 2)
        
    def forward(self, x):
        print(model.cl1.weight,x)
        print(torch.mm(x,model.cl1.weight.T))
        x = self.cl1(x)
        print(x)
        x = F.relu(self.cl2(x))
        return x




model = MyModel()
x = torch.ones(1, 5)
output = model(x)

And this is the output i get for the above code.
As you can see that after the forward propagation step the values of x calculated using matrix multiplication and the values calculated using pytorch are different.
Why is this happening?am i missing something here?
Parameter containing:
tensor([[-0.0975, -0.3880, -0.2666, -0.1913,  0.3015],
        [ 0.0493, -0.3044, -0.3731,  0.2693, -0.3543],
        [ 0.0821, -0.4167, -0.2888,  0.3144,  0.3574],
        [ 0.3467,  0.4166, -0.0122, -0.0539, -0.3886]], requires_grad=True) tensor([[1., 1., 1., 1., 1.]])
tensor([[-0.6419, -0.7133,  0.0484,  0.3086]], grad_fn=<MmBackward>)
tensor([[-0.7729, -1.0955,  0.3968,  0.2085]], grad_fn=<AddmmBackward>)