报错:使用BCEWithLogitsLoss()时RuntimeError: result type Float can‘t be cast to the desired output type

RuntimeError: result type Float can’t be cast to the desired output type long
改为:

test_loss = criterion(y_pred, y_gt.float()).item()

你可能感兴趣的:(报错:使用BCEWithLogitsLoss()时RuntimeError: result type Float can‘t be cast to the desired output type)