-
Notifications
You must be signed in to change notification settings - Fork 5.8k
【Hackathon 9th No.8】Fix 0-size for as_strided grad and add bound check for as_strided #74860
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
【Hackathon 9th No.8】Fix 0-size for as_strided grad and add bound check for as_strided #74860
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
/re-run all-failed |
… accuracy_as_strided
/re-run all-failed |
… accuracy_as_strided
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #74860 +/- ##
===========================================
Coverage ? 100.00%
===========================================
Files ? 2
Lines ? 10
Branches ? 0
===========================================
Hits ? 10
Misses ? 0
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
/re-run all-failed |
/re-run all-failed |
if (input.numel() != 0) { | ||
size = 1; | ||
for (int i = 0; i < input.dims().size(); i++) { | ||
size += input.strides()[i] * (input.dims()[i] - 1); | ||
} | ||
memory_size = size * phi::SizeOf(dtype) + input.offset(); | ||
} |
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.
CheckInBoundsForMemory中 input.numel() != 0 这个判断为true的分支目前永远不会被执行到,覆盖率到不到要求。而且无法豁免coverage的ci,请优化下此处。
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.
Done. coverage ci 已经通过
/re-run all-failed |
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
…k for as_strided (PaddlePaddle#74860) * Fix 0-size for as_strided grad and add bound check for as_strided * fix bugs * fix bugs * fix bugs * refine code * refine code * refine code * refine code to pass coverage ci
PR Category
Operator Mechanism
PR Types
Bug fixes
Description
Fix 0-size for as_strided grad and add bound check for as_strided
PaddleAPITest 中都是 torch error 的例子,所以添加了 check
另外自行测试了
paddle.as_strided(Tensor([0, 32],"float16"), shape=tuple(0,4,), stride=tuple(32,1,), )
这种 case,修复反向 bug修复 #74546 中暴露的 as_strided 0-size 问题