Solved by yanboliang in post #2 
              
              
                By default, the output of BCELoss will be divided by the number of elements in the output. In your example, the first bce loss will be divided by 6 and the second one will be divided by 5, that made the different output. 
You can set “reduction” to “none” or “sum” to see different output. For exampl…