torch.manual_seed(0)
input = torch.tensor([[1.,1.,1.]])
print(torch.nn.Linear(3, 1).weight)
print(torch.nn.Linear(3, 1).bias)
print(list(torch.nn.Linear(3, 1).parameters()))
torch.nn.Linear(3, 1)(input)
I got the result:
Parameter containing:
tensor([[-0.0043, 0.3097, -0.4752]], requires_grad=True)
Parameter containing:
tensor([0.4578], requires_grad=True)
[Parameter containing:
tensor([[-0.0512, 0.1528, -0.1745]], requires_grad=True), Parameter containing:
tensor([-0.1135], requires_grad=True)]
tensor([[-1.1505]], grad_fn=)
I calculated the result by hand using weight and bias, and using parameters, but I get the two different numbers, not the one above -1.1505. Why is it?