torch.nn.BCELoss are unsafe to autocast [How to Solve]

torch.nn.BCELoss are unsafe to autocast

Default initial loss:

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

Temporary solution:

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

Bcewith logitsloss predicts no need for home sigmoid, tags

Read More: