Thanks a lot. I guess I have the same problem of indexing. The scientific notation for LongTensor in the error message is misleading.  I thought the tensor was accidentally cast to FloatTensor, but it was actually still LongTensor just in scientific notation.