Skip to content
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

Merged
merged 2 commits into from
Jun 17, 2021
Merged

Add atan2 op and test #33067

merged 2 commits into from
Jun 17, 2021

Conversation

ronny1996
Copy link
Contributor

@ronny1996 ronny1996 commented May 24, 2021

PR types

New features

PR changes

OPs

Describe

Add atan2 op and test
7d5582637462743d2a6e3c0e76a34148
99a8e6c3b86b2c38dce2a5588d83906b

@paddle-bot-old
Copy link

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@@ -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
Copy link
Contributor

@qili93 qili93 May 25, 2021

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

@qili93
Copy link
Contributor

qili93 commented May 25, 2021

需要新增docs的中文API文档

@paddle-bot-old
Copy link

paddle-bot-old bot commented Jun 4, 2021

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.

qili93
qili93 previously approved these changes Jun 9, 2021
Copy link
Contributor

@qili93 qili93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

.. code-block:: python

import paddle
y=paddle.to_tensor([-1, +1, +1, -1]).astype('float32')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

代码格式问题,

XieYunshen
XieYunshen previously approved these changes Jun 15, 2021
qili93
qili93 previously approved these changes Jun 15, 2021
Copy link
Contributor

@qili93 qili93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

TCChenlong
TCChenlong previously approved these changes Jun 15, 2021
@@ -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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为什么需要增大单测时间?这个对ci影响比较大,这个op计算量感觉不需要这么长的单测时间,如果目前单测确实需要跑较长时间,是否有优化方法?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

50f63c1aa0863288af541ce5fce9e917
这个op单测本地需要6.x秒,TIMEOUT参照其他op单测设置的,需要改的话我改下

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@XieYunshen 请关注并跟进,谢谢

Copy link
Contributor Author

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pr里应该有文档预览截图

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已添加

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

截图不全

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

更新


"""
check_variable_and_dtype(y, 'y', ['float16', 'float32', 'float64'], 'atan2')
check_variable_and_dtype(x, 'x', ['float16', 'float32', 'float64'], 'atan2')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

变量检查应该在动态图调用之后,否则会影响性能

Copy link
Contributor Author

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>);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为什么不支持int类型的输入?

Copy link
Contributor Author

@ronny1996 ronny1996 Jun 16, 2021

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一致

@ronny1996 ronny1996 dismissed stale reviews from TCChenlong, qili93, and XieYunshen via fd058e2 June 15, 2021 12:49
Copy link
Contributor

@lanxianghit lanxianghit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@qili93 qili93 merged commit 918aeb7 into PaddlePaddle:develop Jun 17, 2021
@ronny1996 ronny1996 deleted the atan2_op branch June 17, 2021 03:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants