Why, please ?
x = torch.Tensor(5, 3) allocates space for a tensor, but doesn’t clear the space. This means the values inside are going to be weird.
If you wanted a random tensor, you should do x = torch.randn(5, 3)
. If you wanted zeros, torch.zeros(5, 3)
3 Likes