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

Fix random seed of test_lu_op #55896

Merged
merged 1 commit into from
Aug 8, 2023
Merged

Conversation

Tom-Zheng
Copy link
Contributor

PR types

Bug fixes

PR changes

Others

Description

test_lu_op fails occasionally due to randomness. We fix the random seed in this PR.

@paddle-bot
Copy link

paddle-bot bot commented Aug 2, 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.

@Tom-Zheng
Copy link
Contributor Author

Hi @zyfncg , 可否帮忙review & merge?

@Tom-Zheng
Copy link
Contributor Author

@zhiboniu 可否麻烦review?

@zhiboniu
Copy link
Contributor

zhiboniu commented Aug 3, 2023

这个原来fail的原因是什么?为什么这样修改可以修复问题?

@Tom-Zheng
Copy link
Contributor Author

这个原来fail的原因是什么?为什么这样修改可以修复问题?

会有一定几率挂掉:

test_lu_op failed
 .F.......
======================================================================
FAIL: test_static (test_lu_op.TestLUAPI)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/paddle/paddle/build/test/legacy_test/test_lu_op.py", line 307, in test_static
    run_lu_static(tensor_shape, dtype)
  File "/opt/paddle/paddle/build/test/legacy_test/test_lu_op.py", line 290, in run_lu_static
    np.testing.assert_allclose(
  File "/usr/local/lib/python3.10/dist-packages/numpy/testing/_private/utils.py", line 1530, in assert_allclose
    assert_array_compare(compare, actual, desired, err_msg=str(err_msg),
  File "/usr/local/lib/python3.10/dist-packages/numpy/testing/_private/utils.py", line 844, in assert_array_compare
    raise AssertionError(msg)
AssertionError: 
Not equal to tolerance rtol=1e-05, atol=1e-05
Mismatched elements: 1 / 375 (0.267%)
Max absolute difference: 2.861023e-05
Max relative difference: 3.5195575e-05
 x: array([[[[ 0.938803,  0.936359,  0.219506,  0.384186,  0.405095],
         [ 0.882509, -0.675834,  0.410817, -0.097641,  0.584958],
         [ 0.747691, -0.430984,  0.147271,  0.095768,  0.820007],...
 y: array([[[[ 0.938803,  0.936359,  0.219506,  0.384186,  0.405095],
         [ 0.882509, -0.675834,  0.410817, -0.097641,  0.584958],
         [ 0.747691, -0.430984,  0.147271,  0.095768,  0.820007],...
----------------------------------------------------------------------

@Tom-Zheng
Copy link
Contributor Author

@zhiboniu 原来随机种子没固定, 每次跑的数值不同. 有一定概率某些输入会导致误差略大于设定值.

@Tom-Zheng
Copy link
Contributor Author

Hi @zyfncg , @zhiboniu 已经approve, 您可否帮忙merge?

@zyfncg zyfncg merged commit 4728d58 into PaddlePaddle:develop Aug 8, 2023
@Tom-Zheng Tom-Zheng deleted the gh_fix_lu_op branch August 8, 2023 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers NVIDIA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants