I think the problem is the loss you’re using compared to what you want to do.
From your previous message, it seems like you want to do multiclass classification and that labels is the index of the class.
The loss you’re using is mean square error which just compares the values of each element with a 2-norm. In that case, both inputs needs to have same type and same size.
For multiclass classification, the classical loss is cross entropy loss that is a combination of a softmax and a negative log likelihood loss. This loss takes two inputs: the scores for each class of floating point type (FloatTensor or DoubleTensor) and of size Batch x nb_classes. The second input is the label which has to be of type integer (LongTensor here and should be of size Batch that contains the index of the correct label with values in [0, nb_classes-1].