@coyote I’m sorry for mistake and modified the first comment.(please use nn.Sigmoid() instead)
As @ptrblck first mentioned, I also consider using nn.BCELoss is better way when you don’t use custom loss function.