Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NPU] refine nan check #34508

Merged
merged 2 commits into from
Aug 2, 2021
Merged

Conversation

zhiqiu
Copy link
Contributor

@zhiqiu zhiqiu commented Jul 30, 2021

PR types

Bug fixes

PR changes

Others

Describe

CheckNumerics is very slow, we first call ResuceMean and then check one float variable.

@gongweibao gongweibao self-requested a review July 30, 2021 09:10
Copy link
Contributor

@gongweibao gongweibao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM


return found_inf_data;
if (std::isnan(static_cast<float>(vec[0]))) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LOG(WARNING) << "deteced Nan";

return found_inf_data;
if (std::isnan(static_cast<float>(vec[0]))) {
return true;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (std::isinf(static_cast<float>(vec[0]))){
   LOG(WARNING) << "deteced inf";
}

}
const auto& runner_mean = NpuOpRunner("ReduceMeanD", {*in}, {mean},
{{"axes", axes}, {"keep_dims", false}});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我们不用 "Div" + "ReduceSumD"?

@gongweibao gongweibao merged commit 393a0b1 into PaddlePaddle:develop Aug 2, 2021
gongweibao added a commit that referenced this pull request Aug 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants