Could you explain the shape of your target a bit?
Based on your model definition it looks like you are dealing with a multi-class classification, where you try to classify one out of four possible classes for each sample.
If so, the target should be a LongTensor with the shape [batch_size] containing class indices in the range [0, 3].
dim2 of your target looks as if it’s one-hot encoded, which won’t work with nn.CrossEntropyLoss. I’m not sure, what dim1 represents.
Also, it seems you’ve commented out the view operation, which flattens the output activation of your conv layer, and which would be the usual work flow.
A minor issue: currently you are not using any non-linearity between the last linear layers, which would basically create a single linear layer (with redundant parameters), so I would recommend to add an activation there.