Solved by Dwight_Foster in post #2 
              
              
                So basically what is happening is that the binary cross entropy has two different reduction methods which you can see in the docs. The default one is mean and the other option is sum. In your calculations you are using the sum version while the pytorch loss function is using the mean. All you need t…