[Bug Fix] Fix CastDataTypeFunctor for low-precision floats to complex types#75934
Merged
luotao1 merged 5 commits intoPaddlePaddle:developfrom Oct 24, 2025
Merged
[Bug Fix] Fix CastDataTypeFunctor for low-precision floats to complex types#75934luotao1 merged 5 commits intoPaddlePaddle:developfrom
luotao1 merged 5 commits intoPaddlePaddle:developfrom
Conversation
… types 这些改动新增了 `CastDataTypeFunctor` 针对 `float8_e5m2`、`float8_e4m3fn`、`float16` 和 `bfloat16` 到 `complex<float>`/`complex<double>` 的专门实现。原本的泛型实现只做 `static_cast<OutType>(in)`,而 `phi::dtype::complex<>` 没有接受这些低精度实数类型的隐式转换,实际调用 `TransDataType` 做类型转换时会缺失对应路径或触发编译/运行错误。现在在转换时先显式转成 `float`/`double` 再构造复数,就能让这些低精度实数张量安全地转换成复数张量,确保在需要复数输出(例如调用复数 kernel)时类型升级可以顺利执行。
|
你的PR提交成功,感谢你对开源项目的贡献! |
Contributor
Author
|
/re-run all-failed |
Contributor
Author
|
/re-run all-failed |
Contributor
Author
|
/re-run all-failed |
zhangbo9674
approved these changes
Oct 24, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Category
Environment Adaptation
PR Types
Bug fixes
Description
CastDataTypeFunctor针对float8_e5m2、float8_e4m3fn、float16和bfloat16到complex<float>/complex<double>的专门实现。static_cast<OutType>(in),而phi::dtype::complex<>没有接受这些低精度实数类型的隐式转换,实际调用TransDataType做类型转换时会缺失对应路径或触发编译/运行错误。float/double再构造复数,就能让这些低精度实数张量安全地转换成复数张量,确保在需要复数输出(例如调用复数 kernel)时类型升级可以顺利执行。