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

Fix amp with optiontional api bug #40980

Conversation

zhangbo9674
Copy link
Contributor

@zhangbo9674 zhangbo9674 commented Mar 26, 2022

PR types

Bug fixes

PR changes

APIs

Describe

修复最终态api amp与optional类型tensor组合使用的代码bug.

optional 类 tensor 的amp逻辑如下:

// const paddle::optional<const paddle::experimental::Tensor&> prior_dist
if (egr::Controller::Instance().GetAMPLevel() != paddle::imperative::AmpLevel::O0) {
        ...
        if (prior_dist.get_ptr() != nullptr) amp_tensors_vector.push_back({ *(prior_dist.get_ptr()) });
        ...
        auto NEW_prior_dist = (prior_dist.get_ptr() != nullptr) ? paddle::make_optional<const paddle::experimental::Tensor&>(egr::EagerAmpAutoCast("prior_dist", *(prior_dist.get_ptr()), amp_dst_dtype, op_name)) : prior_dist;
       ...
    }

@phlrain phlrain merged commit 52f07ab into PaddlePaddle:develop Mar 27, 2022
chenwhql added a commit to chenwhql/Paddle that referenced this pull request Mar 28, 2022
@zhangbo9674 zhangbo9674 deleted the debug/fix_final_state_amp_optional_bug branch March 2, 2023 02:59
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.

None yet

2 participants