For a binary classification use case, you could use nn.BCEWithLogitsLoss and just keep the shapes.
If you want to use nn.CrossEntropyLoss, your output should contain a neuron for each class ([128, 2]) while the target should contain the class indices with the shape ([128]).
I would recommend to stick to the first approach, since your shapes are already matching. Make sure to pass the target as a FloatTensor via target = target.float().