-
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
Add atan2 op and test #33067
Add atan2 op and test #33067
Conversation
Thanks for your contribution! |
@@ -149,6 +149,7 @@ | |||
from .tensor.math import acos # noqa: F401 | |||
from .tensor.math import asin # noqa: F401 | |||
from .tensor.math import atan # noqa: F401 | |||
from .tensor.math import atan2 # noqa: F401 |
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.
tensor/__init__.py
里面也需要添加from .math import atan
需要新增docs的中文API文档 |
Sorry to inform you that a743bbe's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually. |
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
python/paddle/tensor/math.py
Outdated
.. code-block:: python | ||
|
||
import paddle | ||
y=paddle.to_tensor([-1, +1, +1, -1]).astype('float32') |
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.
LGTM
@@ -839,6 +839,7 @@ set_tests_properties(test_pool2d_op PROPERTIES TIMEOUT 120) | |||
set_tests_properties(test_transpose_op PROPERTIES TIMEOUT 120) | |||
set_tests_properties(test_eager_deletion_gru_net PROPERTIES TIMEOUT 120) | |||
set_tests_properties(test_activation_op PROPERTIES TIMEOUT 270) | |||
set_tests_properties(test_atan2_op PROPERTIES TIMEOUT 120) |
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.
为什么需要增大单测时间?这个对ci影响比较大,这个op计算量感觉不需要这么长的单测时间,如果目前单测确实需要跑较长时间,是否有优化方法?
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.
@XieYunshen 请关注并跟进,谢谢
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.
已删除,使用默认TIMEOUT
|
||
def atan2(y, x, name=None): | ||
r""" | ||
Element-wise arctangent of y/x with consideration of the quadrant. |
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.
pr里应该有文档预览截图
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.
截图不全
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.
更新
python/paddle/tensor/math.py
Outdated
|
||
""" | ||
check_variable_and_dtype(y, 'y', ['float16', 'float32', 'float64'], 'atan2') | ||
check_variable_and_dtype(x, 'x', ['float16', 'float32', 'float64'], 'atan2') |
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.
已修改
atan2_grad, ops::Atan2GradKernel<paddle::platform::CPUDeviceContext, float>, | ||
ops::Atan2GradKernel<paddle::platform::CPUDeviceContext, double>, | ||
ops::Atan2GradKernel<paddle::platform::CPUDeviceContext, | ||
paddle::platform::float16>); |
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.
为什么不支持int类型的输入?
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.
调查了tensorflow和pytorch,tensorflow不支持int;pytorch前向支持int,且输入int时输出为fp64,反向不支持
更新成和pytorch一致
fd058e2
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
New features
PR changes
OPs
Describe
Add atan2 op and test