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

Fix the div 0 error of matrix_power #49942

Merged
merged 14 commits into from
Jan 31, 2023
Merged

Conversation

Liyulingyue
Copy link
Contributor

@Liyulingyue Liyulingyue commented Jan 19, 2023

PR types

Bug fixes

PR changes

OPs

Describe

related issues

Solution

  • 增加数值比较,要求输入大小不能为0
  • 增加单测,测试零除案例

@paddle-bot
Copy link

paddle-bot bot commented Jan 19, 2023

你的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 contributor External developers status: proposed labels Jan 19, 2023
Comment on lines +315 to +318
# The size of input should not be 0
input = fluid.data(name="input_4", shape=[1, 1, 0, 0], dtype="float32")
self.assertRaises(ValueError, paddle.linalg.matrix_power, input, 2)

Copy link
Contributor

Choose a reason for hiding this comment

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

这个报错可能不是ValueError。导致你的单测挂了。
你可以在本地先删掉self.assertRaises(ValueError, paddle.linalg.matrix_power, input, 2)。再跑一次单测。这时,单测肯定报错,把PADDLE_ENFORCE_NE的The size of Input(X) should not be 0.给抛出来。
你看看报错的报错类型,应该不是ValueError。是什么,你重新填到self.assertRaises里。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

这个报错可能不是ValueError。导致你的单测挂了。 你可以在本地先删掉self.assertRaises(ValueError, paddle.linalg.matrix_power, input, 2)。再跑一次单测。这时,单测肯定报错,把PADDLE_ENFORCE_NE的The size of Input(X) should not be 0.给抛出来。 你看看报错的报错类型,应该不是ValueError。是什么,你重新填到self.assertRaises里。

查出来了~原因是这个报错出现在动态图下面

@wanghuancoder
Copy link
Contributor

PR types

Bug fixes

PR changes

OPs

Describe

related issues

感谢提交代码。描述里最好介绍一下你的分析思路、解决思路。

@luotao1 luotao1 mentioned this pull request Jan 20, 2023
@Liyulingyue
Copy link
Contributor Author

PR types

Bug fixes

PR changes

OPs

Describe

related issues

感谢提交代码。描述里最好介绍一下你的分析思路、解决思路。

PR types

Bug fixes

PR changes

OPs

Describe

related issues

感谢提交代码。描述里最好介绍一下你的分析思路、解决思路。

Done~

Copy link
Contributor

@wanghuancoder wanghuancoder left a comment

Choose a reason for hiding this comment

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

LGTM

@luotao1 luotao1 merged commit fb74147 into PaddlePaddle:develop Jan 31, 2023
pangengzheng pushed a commit to pangengzheng/Paddle that referenced this pull request Feb 2, 2023
* add zero size check in matrix_power_kernel_impl.h

* add zero size check in matrix_power_kernel_impl.h

* add zero size check in unittest

* bug_fix

* bug_fix

* bug_fix

* bug_fix

* bug_fix

* bug fix

* bug_fix

* bug_fix

* add static check

* delete the dy codes
@Liyulingyue Liyulingyue deleted the div0_1 branch February 21, 2023 12:49
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.

4 participants