I solved my problem with:

loss = criterion(output, target.long())

But i don’t know yet why when i do this conversion from a list of ints to a tensor, its data became floats. I’m doing the conversion with torch.Tensor:

target = torch.Tensor(Target_list)

is there a way to specify the dtype of the conversion?