>>> x = torch.autograd.Variable(torch.LongTensor([1]*300))
>>> y = torch.autograd.Variable(torch.LongTensor([1]*300))
>>> torch.sum(x == y)
Variable containing:
 44
[torch.ByteTensor of size 1]

>>> print(torch.__version__)
0.1.12_2
>>> torch.sum((x == y).int())
Variable containing:
300
[torch.IntTensor of size 1]