Your targets should be of the size [batch_size], so just squeeze your tensor and it should work.
target = target.squeeze(1)

CrossEntropyLoss is fine. Note that you have to provide the logits, i.e. your model shouldn’t have a non-linearity as the last layer.
You can find more information on the criterion in the docs 2.