When I use the negative mask like :
mask = torch.autograd.Variable(torch.zeros((3,4 ))).byte()
mask = 1- mask
Pytorch 0.3 shows "RuntimeError: neg is not implemented for type torch.ByteTensor"
It is also observed in Pytorch 0.2, but can be solved in Pytorch 0.2 using:
mask = 1 + (-1) *mask
While in Pytorch 0.3, the previous solution gives the "RuntimeError: value cannot be converted to type uint8_t without overflow: -1".
It is caused by the ByteTensor does not support negative operation. So I use mask = (1-mask.long()).byte() to solve the problem, but it is not elegant.