I am facing a very weird error when I am trying to run the following simple line :
a = torch.Tensor([0,0,0],dtype = torch.int64)
TypeError: new() received an invalid combination of arguments - got (list, dtype=torch.dtype), but expected one of:
* (*, torch.device device)
didn't match because some of the keywords were incorrect: dtype
* (torch.Storage storage)
* (Tensor other)
* (tuple of ints size, *, torch.device device)
* (object data, *, torch.device device)
whereas if we look at official documentation
torch.tensor(data, dtype=None, device=None, requires_grad=False, pin_memory=False) → Tensor
Parameters
data (array_like) – Initial data for the tensor. Can be a list, tuple, NumPy ndarray, scalar, and other types.
dtype (torch.dtype, optional) – the desired data type of returned tensor. Default: if None, infers data type from data.
Why is the code snippet not working even though the official documentation supports it?