# 异常处理
if torch.isnan(loss.item()):
print("Loss exploded at step {}".format(epoch))
raise Exception("Loss exploded")
pytorch 训练出现异常处理
最新推荐文章于 2024-07-22 15:32:54 发布
# 异常处理
if torch.isnan(loss.item()):
print("Loss exploded at step {}".format(epoch))
raise Exception("Loss exploded")