Solved by KFrank in post #3 
              
              
                Hi Krish! 

As an aside, you should use BCEWithLogitsLoss rather than BCELoss 
for reasons of numerical stability. 
To answer your question, the documentation is a little imperfect on this 
point.  BCELoss simply computes the loss for each pair of matching 
elements of the output and target tensors,…