Skip to content

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

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

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)
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.

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')
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.

已修改

Copy link
Contributor

@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
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

3 participants