The difference is actually whether it becomes a python int or a Tensor again.
With (x==y).sum(1) you get the overflow with tensors. Now, Variables never are converted to python numbers (because it would lose autograd).
Best regards
Thomas