nn.BCEWithLogitsLoss expects logits, which can be interpreted as unnormalized probabilities. In your current model you are using F.relu as the last non-linearity, which I would remove to allow positive as well as negative logits. Once this is done, use a default cutoff of 0.0 to get the predicted class indices. Alternatively, apply sigmoid on the model outputs and calculate the predicted classes with a cutoff using a probability (e.g. 0.5) to calculate the accuracy. Do not pass the sigmoid outputs to nn.BCEWithLogitsLoss as logits are expected as already described.