Now, I’m making an assumption here as I have limited information; I’m assuming you want a single output in the range (0, 1) and are tackling a binary classification problem.

Change n_out to 1 and use nn.BCELoss(). [If n_out is 2, use nn.NLLLoss(), and some extra changes are needed, so leave it for now]

If n_out=1, you’ll need to binarize the output from the network in order to use with sklearn’s accuracy_score since a sigmoided output is going to be a float in the interval [0, 1]. You can do that by:

threshold = 0.5
network_output[network_output > threshold] = 1
network_output[network_output <= threshold] = 0