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

【complex op】No.6 add complex support for logical_and/or/xor/not #56323

Merged
merged 12 commits into from
Aug 30, 2023

Conversation

jinyouzhi
Copy link
Contributor

PR types

New features

PR changes

OPs

Description

#56145

@paddle-bot
Copy link

paddle-bot bot commented Aug 15, 2023

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@paddle-bot paddle-bot bot added contributor External developers status: proposed labels Aug 15, 2023
@ScottWong98
Copy link
Contributor

@jinyouzhi 可以先在本地看下 test/legacy_test/test_logical_op.py 是否能通过测试

@jinyouzhi
Copy link
Contributor Author

@ScottWong98 改完了

Copy link
Contributor

@ScottWong98 ScottWong98 left a comment

Choose a reason for hiding this comment

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

def np_data_generator(np_shape, dtype, *args, **kwargs):
if dtype == bool:
return np.random.choice(a=[True, False], size=np_shape).astype(bool)
elif dtype == np.uint16:
x = np.random.uniform(0.0, 1.0, np_shape).astype(np.float32)
return convert_float_to_uint16(x)
else:
return np.random.normal(0, 1, np_shape).astype(dtype)

需判断 dtype 为 np.complex64 或 np.complex128 的情况,否则 L130 最终返回复数的虚部全为0

test/legacy_test/test_logical_op.py Show resolved Hide resolved
@jinyouzhi
Copy link
Contributor Author

def np_data_generator(np_shape, dtype, *args, **kwargs):
if dtype == bool:
return np.random.choice(a=[True, False], size=np_shape).astype(bool)
elif dtype == np.uint16:
x = np.random.uniform(0.0, 1.0, np_shape).astype(np.float32)
return convert_float_to_uint16(x)
else:
return np.random.normal(0, 1, np_shape).astype(dtype)

需判断 dtype 为 np.complex64 或 np.complex128 的情况,否则 L130 最终返回复数的虚部全为0

已添加。

Copy link
Contributor

@ScottWong98 ScottWong98 left a comment

Choose a reason for hiding this comment

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

LGTM

@jinyouzhi
Copy link
Contributor Author

@GGBond8488 @luotao1

Copy link
Contributor

@GGBond8488 GGBond8488 left a comment

Choose a reason for hiding this comment

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

LGTM

@luotao1 luotao1 merged commit 5cbf5bd into PaddlePaddle:develop Aug 30, 2023
@luotao1
Copy link
Contributor

luotao1 commented Aug 30, 2023

@jinyouzhi 中文文档也要修复一下

@jinyouzhi jinyouzhi deleted the complex_logical branch August 30, 2023 04:18
@luotao1 luotao1 added HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务 and removed HappyOpenSource 快乐开源活动issue与PR labels Sep 6, 2023
BeingGod pushed a commit to BeingGod/Paddle that referenced this pull request Sep 9, 2023
…lePaddle#56323)

* 【complex op】No.6 add complex support for logical_and/or/xor/not

* fix dtype check

* modify the docs

* add special condition for not raise when x.dtype is complex

* add random generate for complex dtype

* fix generate for complex

* fix

* fix

* add corner case for complex type

* fix ut

* fix ut
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants