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

【Hackathon 6th No.31】paddle.standard_normal and paddle.randn support complex normal distribution -part #65032

Merged
merged 8 commits into from
Jun 24, 2024

Conversation

NKNaN
Copy link
Contributor

@NKNaN NKNaN commented Jun 11, 2024

PR Category

User Experience

PR Types

Improvements

Description

Upgrade paddle.standard_normal, paddle.randn to support complex normal distribution.
Also add code examples for paddle.normal

Copy link

paddle-bot bot commented Jun 11, 2024

你的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 the contributor External developers label Jun 11, 2024
if core.is_compiled_with_cuda()
else paddle.CPUPlace()
)
paddle.disable_static(place)

Choose a reason for hiding this comment

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

动态图、静态图的切换建议使用dygraph_guard、static_guard,保证切换不会影响其他单测

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已修改

var_imag = out.numpy().imag.var()
np.testing.assert_allclose(var, 1.0, rtol=0.2, atol=0.2)
np.testing.assert_allclose(var_real, 0.5, rtol=0.2, atol=0.2)
np.testing.assert_allclose(var_imag, 0.5, rtol=0.2, atol=0.2)

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.

rtol=0.2, atol=0.2参考的是 test_normal 里 TestNormalAPI 类的设置。
改成rtol=0.02, atol=0.02了

paddle.set_device('gpu')
test_complex64()
test_complex128()
paddle.set_device('cpu')

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.

已修改

Copy link

@zhiminzhang0830 zhiminzhang0830 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 06fff2c into PaddlePaddle:develop Jun 24, 2024
32 of 33 checks passed
co63oc pushed a commit to co63oc/Paddle that referenced this pull request Jun 25, 2024
…complex normal distribution -part (PaddlePaddle#65032)

* update standard_normal and randn

* update standard_normal

* revise code examples

* update randn

* update test

* update test

* fix test and docs example
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants