I’m evaluating the performance of my model using the cross-entropy loss. I flatten my target variables using flatten construct from torch to get a [x,1] tensor object. I received a Runtime Error: Expected object of scalar type Long by got a scalar type Int for argument #2 target.

I was able to fix using the scalar type long. I still don’t understand why it didn’t work since borth functions produce the same shape? What’s the difference betweeen Long vs Flatten in Pytorch?