Could you explain what the target contains and what dim1 is used for in [100, 2]?
Based on the shape it should be a multi-class classification target for a sequence length of 2, but I guess you might be using a one-hot encoded target for a binary classifiaction?
If that’s the case, you would have to create a target in the shape [batch_size=100], which contains the class indices in [0, 1] (or use alternatively nn.BCEWithLogitsLoss).
Since your current model outputs a 4-dimensional tensor, you could flatten the activation and add linear layers to the model to get the desired output shape.
Have a look at this tutorial 3 for a simple CNN.