Type Hinting torch.float for special form type hint
I have a function that can take a typing.Union of types including the type torch.float. But if I use the typing.Union type with torch.float as argument, I receive an error. Here is an example:
from typing import Union
import torch

def fct(my_float_or_tensor: Union[torch.float, torch.Tensor]):
    pass

And I get the error
TypeError: Union[t0, t1, ...]: each t must be a type. Got torch.float32.

What am I doing wrong?
Interestingly, the same problem occurs with the special type typing.Tuple but not if I use torch.float directly when type hinting.

There is a difference between &quot;dtypes&quot; and &quot;types&quot;. torch.float is a dtype. For type hinting, use torch.FloatTensor (there are also others, e.g., DoubleTensor, HalfTensor etc.)
