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

[PaddlePaddle Hackathon] add paddle.nn.ClipGradByNorm单测 #278

Merged
merged 50 commits into from
Nov 3, 2021
Merged

[PaddlePaddle Hackathon] add paddle.nn.ClipGradByNorm单测 #278

merged 50 commits into from
Nov 3, 2021

Conversation

justld
Copy link
Contributor

@justld justld commented Oct 25, 2021

PR types:New features

PR changes:APIs

Describe

Task: #35962

添加paddle.nn.ClipGradByNorm单测,PaddleTest\framework\api\nn\test_clip_grad_by_norm.py

justld and others added 30 commits October 10, 2021 07:31
…test_clip_grad_by_norm.py, modify test_pixel_shuffle.py
try:
paddle_clip(paddle_data)
except RuntimeError:
pass
Copy link
Collaborator

Choose a reason for hiding this comment

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

使用apibase里面的exception方法

Copy link
Contributor Author

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捕获异常的话,应该怎么修改呢?

Copy link
Collaborator

Choose a reason for hiding this comment

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

这里直接使用 with pytest.raises 方式吧

Copy link
Contributor Author

Choose a reason for hiding this comment

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

您好,已经修改了。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

不好意思,之前的没通过ci,现在已经OK了。

@justld justld requested a review from kolinwei October 31, 2021 12:34
@CLAassistant
Copy link

CLAassistant commented Nov 3, 2021

CLA assistant check
All committers have signed the CLA.

@DDDivano DDDivano merged commit 9aecfb1 into PaddlePaddle:develop Nov 3, 2021
@justld justld deleted the test_ClipGradByNorm branch November 4, 2021 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants