There could be an overflow, since torch.eq returns a torch.uint8 tensor.
You could convert it to torch.long before calling sum.
I think this bug is fixed in the latest stable release though.
You can find the install instructions in the website 1.