Why torch.sum() yields different results for Variable and it's data?

I stumbled upon this when calculating accuracy of a classifier:

    correct = (indexes == targets)
    print(correct.sum().data[0])
    print(correct.data.sum())
    >>> 155  # this one is wrong
    >>> 1179  # this one is correct

why can this be happening?

This has already been answered multiple times, please see this question for example: Sum of Variable not equal to sum of its data