In fact, I just tried:
      pred_batch[pred_batch >= 0] = 1
      pred_batch[pred_batch < 0] = 0

and
      pred_batch = torch.sigmoid(pred_batch)
      pred_batch[pred_batch >= 0.5] = 1
      pred_batch[pred_batch < 0.5] = 0

but in both cases the model is not learning