-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Recommend to use np.testing.assert_allclose instead of assertTrue(np.allclose(...)) #44641
Labels
Comments
This was referenced Aug 2, 2022
Merged
9 tasks
Ligoml
added
status/developed
开发完成
type/new-feature
确认的新需求
PR is welcome
and removed
status/following-up
跟进中
type/feature-request
新需求申请
labels
Aug 23, 2022
Reopen this issue. I saw test_fused_feedforward_pass failed
F
======================================================================
FAIL: test_pass (test_fused_feedforward_pass.TestFusedFeedforwadPass)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/opt/paddle/paddle/build/test/legacy_test/test_fused_feedforward_pass.py", line 168, in test_pass
assert np.allclose(ret_loss, ret_loss_fused)
AssertionError |
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
需求描述 Feature Description
Now many unit tests use
assertTrue(np.allclose(x, y), "error message")
to compare two tensors, but its error message is helpless. BecauseassertTrue
cannot tell developer the details, such as which value in tensor causes wrong, how different between two tensors is. For instance:The error message only tells developer that
False is not true
. That's all.If using
np.testing.assert_allclose
, the error message will be much clearer. The developer can quickly understand what and where goes wrong from CI log.替代实现 Alternatives
Replace
assertTrue(np.allclose(...))
withnp.testing.assert_allclose
in all unit-tests, please.The text was updated successfully, but these errors were encountered: