-
Notifications
You must be signed in to change notification settings - Fork 24.7k
Small improvements to NJT matrix multiplies #146405
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
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/146405
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ✅ No FailuresAs of commit 2b2d432 with merge base 57b1fc3 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
@pytorchbot label "topic: not user facing" |
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.
Thanks for the PR! Added some small comments
Btw, there's some existing infra around testing that we can use that will automatically test forward, backward, compile, etc. (See the tests under TestNestedTensorOpInfo)
To test the new inputs that you are supporting here, instead of adding new one-off tests here, you can add the inputs that you would like to test to sample_inputs_matmul
in torch/testing/_internal/opinfo/definitions/nested.py
Thanks for the review @soulitzer! I've made changes based on the comments, and updated the tests to use the existing test infra/setup which is much nicer. |
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.
Thanks for quick updates! Just have another nit
Thanks for the quick review @soulitzer! Just committed that small change. Could you rerun the workflows when you get a chance? As I think that's needed before I can merge. |
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.
Awesome, thanks for the PR! looks solid on my end, thanks for updating the generated sample inputs to cover this case :)
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Fixes #146404
Adds changes to the matmul and matmul_backward operation for nested jagged tensors, to support back propagation when the output is a regular strided tensor.
This required adding support for the nested matmul operation to work when the nested tensor wasn't 'self', i.e
A@B
whereA
isn't nested butB
is.The operation schemas had to be updated to reflect that either input can be a strided tensor instead (and the gradient), so an extra assertion is added in an edge case where neither input is nested.
Unit tests are also added.