Hi,
I think problem is that you are missing the batch dimension on your target_tensor.
The error says that the size of the 0th dimension is not equal to the batch size.
Try changing this: loss = criterion(output, target_tensor[i].unsqueeze(0)).