torch.nn.BCELoss are unsafe to autocast

torch.nn.BCELoss are unsafe to autocast

默认初始loss:

lobj = torch.zeros(1, device=device)

临时解决方法:

bce_loss = nn.BCEWithLogitsLoss(reduction="sum").to(device)

BCEWithLogitsLoss 预测不需要家sigmoid,标签

你可能感兴趣的:(pytorch知识宝典)