-
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
[Zero-Dim] add where, atan2, median 0-Dim ut #49692
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
fbee988
to
90f0a80
Compare
self.assertEqual(x1.grad.numpy(), 0) | ||
self.assertEqual(x2.grad.numpy(), 1) | ||
|
||
def test_atan2(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.
这个api是二元支持广播的吗?支持的话可以直接放到binary_api_list里
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.
atan和where不支持广播
x1.stop_gradient = False | ||
x2.stop_gradient = False | ||
out = paddle.where(x1 > x2, x1, x2) | ||
paddle.static.append_backward(out) |
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.
paddle.static.append_backward(out.sum()) 然后测下前反向的值和shape吧
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.
已更新
self.assertEqual(res[0].shape, ()) | ||
|
||
@prog_scope() | ||
def test_atan2(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.
同广播问题
@@ -43,6 +43,10 @@ void WhereKernel(const Context& ctx, | |||
|
|||
int ret = xpu::select( | |||
ctx.x_context(), cond_data, x_data, y_data, out_data, cond_dims, x_dims); | |||
|
|||
if (cond_dims.size() == 0 && x_dims.size() == 0) { |
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.
这个按道理kernel内部不会单独去改变shape,如果infermeta是对的,这个还需要改不
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.
只在两个输入都是0维时需要,前面为了计算0维,做了特殊处理
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
PR types
Others
PR changes
Others
Describe
add where, atan2, median 0-Dim ut