Firstly, nn.CrossEntropyLoss() is mostly used when you need multple predictions.
Since you have just one output neuron, you must use nn.Sigmoid() followed by nn.BCELoss() or simply nn.BCELossWithLogits().
Just need a clarification,

You have single output neuron.
Your target spans between 0 and 1.

Consider a batch-size of 7.

pred_batch will be of shape (7,1) since u have single neuron.
target shape will be (7,) with minimum value of 0 and maximum value of 1.
Right ?

How come you are able to pass these inside CrossEntropyLoss() without getting any error.?