I understand that PyTorch tensors are homogenous, ie, each of the elements are of the same type.
How do I find out the type of the elements in a PyTorch tensor?
There are three kinds of things:
dtype || CPU tensor || GPU tensor
torch.float32 torch.FloatTensor torch.cuda.FloatTensor
The first one you get with print(t.dtype)
if t
is your tensor, else you use t.type()
for the other two.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With