Calling tensor.long() returns a LongTensor, which is the tensor data type.
The error message explains, that you are passing an IntTensor instead of a LongTensor.
The data type is independent of the tensor shape.