-
Notifications
You must be signed in to change notification settings - Fork 115
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
[PaddlePaddle Hackathon] add paddle.nn.ClipGradByNorm单测 #278
Conversation
…test_clip_grad_by_norm.py, modify test_pixel_shuffle.py
try: | ||
paddle_clip(paddle_data) | ||
except RuntimeError: | ||
pass |
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.
使用apibase里面的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.
您好,apibase的exception运行时,425行代码 _check_params函数会把data通过paddle.to_tensor转换成tensor,但是paddle.nn.ClipGradByGlobalNorm实例调用时传入的参数类型是list[tuple, tuple, tuple...],会导致运行出错,所以才使用try except这种方式捕获异常。如果使用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.
这里直接使用 with pytest.raises 方式吧
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.
您好,已经修改了。
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.
不好意思,之前的没通过ci,现在已经OK了。
…to test_ClipGradByNorm
…to test_ClipGradByNorm
PR types:New features
PR changes:APIs
Describe
Task: #35962
添加paddle.nn.ClipGradByNorm单测,PaddleTest\framework\api\nn\test_clip_grad_by_norm.py