-
Notifications
You must be signed in to change notification settings - Fork 584
pd: revert einsum to matmul for paddle backend #4768
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
Conversation
revert einsum to matmul for paddle backend Signed-off-by: HydrogenSulfate <490868991@qq.com>
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.
Pull Request Overview
Reverts the Paddle backend virial computation from einsum to explicit matrix multiplication to ensure proper infermeta error handling.
- Replace
paddle.einsum("...ik,...ij->...ikj", …)with unsqueeze and@-based matmul - Align tensor dims for virial calculation without using einsum
Comments suppressed due to low confidence (1)
deepmd/pd/model/model/transform_output.py:84
- Add a unit test for the
do_virialbranch to verify thatextended_virialhas the correct shape and values when using the new matmul-based implementation.
if do_virial:
📝 WalkthroughWalkthroughThe computation of Changes
Possibly related PRs
Suggested labels
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
⏰ Context from checks skipped due to timeout of 90000ms (29)
🔇 Additional comments (1)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
caic99
left a comment
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. @HydrogenSulfate Would you explain more about einsum "may not trigger infermeta error"?
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## devel #4768 +/- ##
=======================================
Coverage 84.79% 84.79%
=======================================
Files 698 698
Lines 67734 67734
Branches 3540 3541 +1
=======================================
Hits 57432 57432
Misses 9171 9171
Partials 1131 1131 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There seems a bug in infermeta of einsum or operators it invoked when use |
@HydrogenSulfate Maybe you can try keep the first two dimensions explicitly in |

revert einsum to matmul for paddle backend as einsum may not trigger infermeta error.
Summary by CodeRabbit