This has nothing to do with your network. You network is fine I tested it by copying your code and putting torch.rand(3,3,200,200) through it.
This error comes from your loss function. The output of your network seems to be a tensor of size (1, 4000) while the target seem to be of size (4000).
Since you said your input is batchsize 3 none of that makes sense.
Did you maybe use batchsize 1 when this error occurred? If so you can make it work by just unsqueezing the target like this target = torch.unsqueeze(target, 0)
Or does it also happen with batchsize higher than 1?
If so can you post your code. Specifically the bit between the output of your net and where your loss function is called.