There are a few bugs in your code.
The CrossEntropyLoss combines LogSoftMax and NLLLoss in one single class. Since you are using sigmoid as your output activation, you should probably use BCELoss.
Also, you reassign loss in your loop. You could rename the loss function to criterion.
Hope this helps!