i import Torch already, how come tensor is not defined.
also tried from torch import tensor
Hi,
You might want to check a python tutorial on how to import libraries.
But if you do:
import torch
torch.Tensor(xxx)
This will work.
In that file you access Tensor
and not torch.Tensor
. So for that to work, if you want a pytorch Tensor, you need to have from torch import Tensor
(capital T) in that file.
That is surprising. Do you delete it later?
If you have just this import and this call. This will work fine.
Use torch.tensor(1)
instead of torch.Tensor(1)