-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
【PaddlePaddle Hackathon 4】No.56 : add fp16 test and bf16 for searchsorted #53205
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
✅ This PR's description meets the template requirements! |
Sorry to inform you that c07c5f5's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually. |
paddle/phi/kernels/funcs/algorithm.h
Outdated
@@ -48,7 +48,7 @@ HOSTDEVICE inline size_t LowerBound(const T1 *x, size_t num, const T2 &val) { | |||
while (count > 0) { | |||
int64_t step = (count >> 1); | |||
auto *it = first + step; | |||
if (*it < val) { | |||
if (static_cast<float>(*it) < static_cast<float>(val)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
建议不要直接转换为float,最好使用文档里提供的MyTypeTrait来判断需要转换的类型
paddle/phi/kernels/funcs/algorithm.h
Outdated
@@ -71,7 +71,7 @@ HOSTDEVICE inline size_t UpperBound(const T1 *x, size_t num, const T2 &val) { | |||
while (count > 0) { | |||
auto step = (count >> 1); | |||
auto *it = first + step; | |||
if (val < *it) { | |||
if (static_cast<float>(val) < static_cast<float>(*it)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
建议不要直接转换为float,最好使用文档里提供的MyTypeTrait来判断需要转换的类型
@@ -215,5 +219,46 @@ def test_sortedsequence_values_type_error(): | |||
self.assertRaises(TypeError, test_sortedsequence_values_type_error) | |||
|
|||
|
|||
class TestSearchSortedFP16OP(TestSearchSorted): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FP16和BF16的单测数量较少,请再增加几例
Sorry to inform you that 5134014's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually. |
Sorry to inform you that 33ab075's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually. |
} else if (type == phi::DataType::FLOAT16) { | ||
visitor.template apply<int16_t>(); | ||
} else if (type == phi::DataType::BFLOAT16) { | ||
visitor.template apply<uint16_t>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里如果是phi::DataType::FLOAT16,apply应该是需要写成phi::dtype::float16
如果是phi::DataType::BFLOAT16,应该是phi::dtype::bfloat16
@zhangting2020 辛苦帮忙看看这个问题 一开始报错如下: 经分析是IsInf和IsNan函数被重载了多次,编译器无法区分调用哪个重载版本,于是针对float16和bfloat16类型做出如下修改: 但还是无法进行解决 |
PR types
Others
PR changes
APIs
Description
相关链接:
#51281
#54871