Solved by albanD in post #2 
              
              
                I think the problem is that y_hot is of type long and the BCE loss expects a Tensor of type float. 
Can you try converting y_hot with y_hot = y_hot.type_as(output).