-
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
[CodeStyle][F821] fix test_exception in test_unpool3d_op and test_unpool_op #47756
[CodeStyle][F821] fix test_exception in test_unpool3d_op and test_unpool_op #47756
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
ValueError, | ||
r"index should less than output", | ||
indices_value_error, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GPU 是没有这个报错的,因此这里仅在 CPU assert
paddle.disable_static() | ||
|
||
def tearDown(self): | ||
paddle.enable_static() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test_exception 使用动态图进行测试
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PR types
Others
PR changes
Others
Describe
在查看 F821 已有问题时发现的,修复了一下这两个单测,算是顺带修复了几个 F821 问题(75 个 -> 70 个,修复了 5 个,剩余很多,需要之后慢慢修)
这两个单测 assertRaises ValueError 都是
paddle.randint(shape=[1, 1, 3, 3, 3])
报的(randint 需要传入 low、high),而不是需要测试的 API/OP(F.max_unpool2d
)报的(名字都写成F.maxunpool2d
了,肯定不是他报的……),因此将其余部分改对(除此之外错误还有不少……),使 ValueError 确实在需要测试的 API 报错为了确保这一点,使用 assertRaisesRegex 代替了 assertRaises,这样能对 Error 的 message 有一个约束,可以确保是需要的那个错误
Related links
name
cattidea/paddle-flake8-project#79