x = torch.tensor([False], dtype=torch.bool)
~x # error
any simple way of doing negation ?
x = torch.tensor([False], dtype=torch.bool)
~x # error
any simple way of doing negation ?
Iām not near a PC now to test. Does not x
work?
I have just tried this:
~
Works like a dream
However, my dtype is not bool, it is torch.uint8
Which is the default output when you do logical operation on a tensor like x>0
He should change dtype to uint8 and tilde operator will work.
Not sure which pytorch version you have, but in 1.4, ~x works fine on torch.bool tensors.
~x does not work, however (x == False) works fine.