-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
【Hackathon 5th No.13】【关联 PR】Added uint8&int8&int16 support for compare_kernel -part #58209
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
402595f
to
13d8b5c
Compare
3d88e7f
to
23aa5e6
Compare
b57ebc1
to
c8d4a5b
Compare
Sorry to inform you that 584a3d4's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually. |
@@ -110,6 +110,7 @@ PD_REGISTER_KERNEL(equal_all, | |||
ALL_LAYOUT, \ | |||
phi::func##Kernel, \ | |||
bool, \ | |||
int8_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.
你这里对所有的compare kernel 都添加了int8_t 类型的注册?但单测里只加了less_than的测试
kernel->OutputAt(0).SetDataType(phi::DataType::BOOL); \ | ||
} | ||
|
||
PD_REGISTER_COMPARE_KERNEL(less_than, LessThan) |
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.
这里应该调用PD_REGISTER_LESS_THAN_KERNEL?若是,这里其实不需要宏定义,直接使用PD_REGISTER_KERNEL即可,因为你这样写并没有节省code
bafbabe
to
f22b939
Compare
@@ -513,7 +523,7 @@ def test_check_output(self): | |||
|
|||
|
|||
class TestCompareOpError(unittest.TestCase): | |||
def test_errors(self): | |||
def test_int16_support(self): |
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.
这里为什么改名呢?
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.
这里为什么改名呢?
当时想的是功能变化了,最开始这里描述的是一旦遇到int16的输出就报错,我把他的内容改为检测是否支持int16的test,我现在调整回来~
op = eval("paddle.%s" % self.op_type) | ||
self.assertRaises(TypeError, op, x=x, y=a) | ||
self.assertRaises(TypeError, op, x=a, y=y) |
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.
46-51为什么要修改呢,用原来的方式不行么?
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.
46-51为什么要修改呢,用原来的方式不行么?
是的,如果用原来的就会报类型错误,因为这个单侧本来的意义在于,防止compare的kernel能够使用int16,一旦检测到int16类型后会自动抛异常,对于50和51行而言:
50行检查当 x 是 int32 类型而 y 是 int16 类型时,调用 op 是否会引发错误。
51行检查当 x 是 int16 类型而 y 是 int32 类型时,同样的情况。
然而这个pr的功能本身就是支持int16,所以必须得调整这个地方
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.
那前面单测的名字就不应该改回来了 test_int16_support 比较合适
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.
那前面单测的名字就不应该改回来了 test_int16_support 比较合适
好的好的,最后那个文档风格检测可能是我修改了一部分源码里的注释导致的,可能需要看一看怎么检查一下
shall we add |
No problem, it’s a good suggestion~ |
Done |
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.
LGTM
请修改下对应API的中文文档:equal、greater_equal、greater_than、less_equal、less_than、not_equal |
|
…e_kernel -part (PaddlePaddle#58209) * 【Hackathon 5th No.13】【关联 PR】Added int8 support for less_than * update 1.0 * update test * update v1.3 * Update test_compare_op.py * Update test_compare_op.py * Update test_compare_op.py * Update test_compare_op.py,test=document_fix * Update test_compare_op.py * Update test_compare_op.py * Update test_compare_op.py * Update test_compare_op.py * Update test_compare_op.py * Update test_compare_op.py * Update compare_kernel.cc * Update compare_kernel.cu * Update compare_kernel.cc * Update compare_kernel.cu * Update test_compare_op.py * Update logic.py * Update compare_kernel.cc * Update compare_kernel.cc
PR types
Others
PR changes
Others
Description
reference link: #57882