未验证 提交 d5c3f032 编写于 作者: N niuliling123 提交者: GitHub

[cherry-pick] Fix core dumped in training when check_nan_inf=1 (#53423)

修复优化器精度检查bug
上级 6583c390
......@@ -114,7 +114,9 @@ void CheckTensorHasNanOrInf(const std::string& api_name, const Tensor& tensor) {
void CheckTensorHasNanOrInf(const std::string& api_name,
const paddle::optional<Tensor>& tensor) {
CheckTensorHasNanOrInf(api_name, tensor.get());
if (tensor) {
CheckTensorHasNanOrInf(api_name, *tensor);
}
}
void CheckTensorHasNanOrInf(const std::string& api_name,
......@@ -168,7 +170,7 @@ void CheckTensorHasNanOrInf(
const std::string& api_name,
const paddle::optional<std::vector<Tensor>>& tensors) {
if (tensors) {
CheckTensorHasNanOrInf(api_name, tensors.get());
CheckTensorHasNanOrInf(api_name, *tensors);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册