For example I have a variable z = [1, 3, None, 5, 6]
I would like to do: torch.tensor(z)
and get something like the following:
torch.tensor([1,3, None, 5,6], dtype=torch.float)
Howhever, such attempt raises an error
TypeError: must be real number, not NoneType
Is there a way to convert such list to a torch.tensor?
I don't want to impute this None value with something else. Numpy arrays are capable of converting such lists np.array([1, 3, None, 5, 6]), but I'd prefer not to convert back and forth variable either.