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 complex op #37918

Merged
merged 4 commits into from
Dec 18, 2021
Merged

add complex op #37918

merged 4 commits into from
Dec 18, 2021

Conversation

iclementine
Copy link

@iclementine iclementine commented Dec 7, 2021

PR types

New features

PR changes

OPs

Describe

  1. Add complex operator and API paddle.complex. (it supports broadcasting!)
  2. enhance elementwise related facilities, add support for cases where input and output have different data types

Examples

import paddle
x = paddle.arange(2, dtype=paddle.float32).unsqueeze(-1)
y = paddle.arange(3, dtype=paddle.float32)
z = paddle.complex(x, y)
print(z.numpy())

# [[0.+0.j 0.+1.j 0.+2.j]
#  [1.+0.j 1.+1.j 1.+2.j]]

@paddle-bot-old
Copy link

paddle-bot-old bot commented Dec 7, 2021

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

Copy link
Contributor

@jeff41404 jeff41404 left a comment

Choose a reason for hiding this comment

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

LGTM

@iclementine
Copy link
Author

iclementine commented Dec 17, 2021

Complex op has 2 inputs that may require gradient computation. But we have to test with cases when only one of them requires gradient computation. So 'no_grad_set' is used in op test cases. @Shixiaowei02

Copy link
Contributor

@TCChenlong TCChenlong left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@XiaoguangHu01 XiaoguangHu01 left a comment

Choose a reason for hiding this comment

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

LGTM

@iclementine iclementine merged commit 31e874b into PaddlePaddle:develop Dec 18, 2021
@iclementine iclementine deleted the complex_op branch December 20, 2021 02:53
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