When I train my model, I always randomly get the following error:
IndexError: tensors used as indices must be long, byte or bool tensors.

I know what this error message saying about but why this error comes out randomly? And should I add .long() whenever trying to index a tensor by another tensor?