Fix addmm with empty matrices and beta != 1.0#2715
Fix addmm with empty matrices and beta != 1.0#2715angeloskath merged 3 commits intoml-explore:mainfrom
Conversation
angeloskath
left a comment
There was a problem hiding this comment.
I left a minor comment for the gpu implementation and a rather larger one for the cpu. Feel free to ask any questions if something doesn't make sense.
9d5577a to
ec39583
Compare
|
@angeloskath I’ve addressed your feedback, |
angeloskath
left a comment
There was a problem hiding this comment.
Looks good I will merge after the tests pass.
- Fix CPU backend to apply beta scaling for empty matrices (K=0) - Fix Metal backend to apply beta scaling for empty matrices (K=0) - Add comprehensive tests for empty matrix addmm with various beta values - Tests cover different shapes and batched empty matrices The bug occurred when addmm was called with empty matrices (one dimension is 0) and beta != 1.0. The function would return C instead of beta * C because the early return for empty matrices didn't apply beta scaling. Fixes ml-explore#2698
ec39583 to
e4140bd
Compare
|
Temporary array Added The fix is now passing locally and ready for CI rerun. Could you please approve the workflow when you get a chance? |
Fixes #2698 [BUG] mx.addmm with empty a and b produces incorrect result
Proposed changes
The bug occurred when addmm was called with empty matrices (one dimension is 0) and beta != 1.0. The function would return C instead of beta * C because the early return for empty matrices didn't apply beta scaling.
Checklist
Put an
xin the boxes that apply.pre-commit run --all-filesto format my code / installed pre-commit prior to committing changes