Nan in torch.Tensor

Why, please ?
torch

1 Like

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)

2 Likes