Your problem is, that the sigmoid is no criterion but an activation meaning it only accepts one input tensor and not two (which would be one for the prediction and one for the target). I think you are looking for the BCELoss instead.