提交 46fe73f8 编写于 作者: N niuliling123

Fix core dumped in training when check_nan_inf=1

上级 3650c4a8
......@@ -115,7 +115,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,
......@@ -169,7 +171,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.
先完成此消息的编辑!
想要评论请 注册