Some difference between pytorch version 1.0.0 and pytorch version 1.7.1

I have two code with difference pytorch version
In torch 1.0.0
torch.randn(4, 4).view(-1)>0. The result of this is tensor([0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1], dtype=torch.uint8)
In torch 1.7.1
torch.randn(4, 4).view(-1)>0. The result of this is tensor([ True, True, False, False, False, True, False, True, False, True, True, True, False, True, False, False])
I don’t know what is happen?
Note: This is no problem for me, i can solve with key word “convert true flase to 0 1 python”. But i want to know how to torch work.
Thanks for reading.


This is expected yes.
Comparison operations now return the new boolean dtype instead of the old uint8 dtype.
This should not be a problem as both can be used for masking and regular ops. But the using uint8 as a boolean is deprecated an will be removed in the future.

Thanks your answer. It so great!!