The doc says "
torch.Tensor is an alias for the default tensor type (
However I found it is not that trivial. When I run the following code:
a = torch.zeros(3,4)
isinstance(a, torch.Tensor) # Return True
isinstance(a, torch.FloatTensor) # Return True
Things look good so far. However, if I check the mro of both classes:
torch.Tensor.__ mro__ # Return (torch.Tensor, torch.C.TensorBase, object)
torch.FloatTensor.__ mro__ # Return (torch.FloatTensor, object)
There seems to be no inheritence between FloatTensor and Tensor. Then how could isinstance return True for both two classes?
Could someone point out these two classes’ relationship, or anything wrong with my understanding of isinstance() and mro?