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

[PIR] Adaptation of TestNoBackwardAPIStatic.test_unique* #62794

Merged
merged 4 commits into from
Mar 17, 2024

Conversation

gouzil
Copy link
Member

@gouzil gouzil commented Mar 17, 2024

PR types

Bug fixes

PR changes

Others

Description

适配 test/legacy_test/test_zero_dim_no_backward_api.py 下的 TestNoBackwardAPIStatic.test_unique_consecutiveTestNoBackwardAPIStatic.test_unique,改为测试执行后的结果

我们在这里不能直接使用 Value 进行比较,一个是unique_consecutive,一个是uniform

相关链接:

Copy link

paddle-bot bot commented Mar 17, 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 Mar 17, 2024
self.assertEqual(inverse, 0)
self.assertEqual(counts, 1)
self.assertEqual(res[0].shape, (1,))
res = self.exe.run(prog, fetch_list=[x, y, inverse, counts])
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
res = self.exe.run(prog, fetch_list=[x, y, inverse, counts])
x_res, y_res, inverse_res, counts_res = self.exe.run(prog, fetch_list=[x, y, inverse, counts])

这样一目了然,不然下面取下标还得看 0、1、2、3 分别是啥

self.assertEqual(counts, 1)
self.assertEqual(res[0].shape, (1,))
res = self.exe.run(prog, fetch_list=[x, y, inverse, counts])
self.assertEqual(res[0], res[1])
Copy link
Member

@SigureMo SigureMo Mar 17, 2024

Choose a reason for hiding this comment

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

合理,原来代码就是个隐藏的 bug,Variable == Variable 返回 Variablebool(Variable) 永远为 True

Comment on lines 500 to 501
self.assertEqual(res[2], 0)
self.assertEqual(res[3], 1)
Copy link
Member

Choose a reason for hiding this comment

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

这里修改也是合理的,原来就是 bug

self.assertEqual(inverse, 0)
self.assertEqual(counts, 1)
self.assertEqual(res[0].shape, (1,))
res = self.exe.run(prog, fetch_list=[x, y, index, inverse, counts])
Copy link
Member

Choose a reason for hiding this comment

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

同上,使用名字吧

SigureMo
SigureMo previously approved these changes Mar 17, 2024
Copy link
Member

@SigureMo SigureMo left a comment

Choose a reason for hiding this comment

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

LGTMeow 🐾

@SigureMo SigureMo merged commit a2dd9e4 into PaddlePaddle:develop Mar 17, 2024
30 checks passed
@gouzil gouzil deleted the fix_test_zero_dim_4 branch April 9, 2024 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants