-
Notifications
You must be signed in to change notification settings - Fork 27
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 axis use for sum #543
fix axis use for sum #543
Conversation
Qodo Merge was enabled for this repository. To continue using it, please link your Git account with your Qodo account here. PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
Qodo Merge was enabled for this repository. To continue using it, please link your Git account with your Qodo account here. PR Code Suggestions ✨No code suggestions found for the PR. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #543 +/- ##
===========================================
- Coverage 90.05% 90.01% -0.04%
===========================================
Files 102 102
Lines 6222 6222
===========================================
- Hits 5603 5601 -2
- Misses 619 621 +2
... and 1 file with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
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!
User description
Note: This is not critically needed, because users can just pass
axis=[x]
instead ofaxis=x
and it will work - it's more aesthetic than anything.Context:
np.sum
only accepts ints for theaxis
, or tuples of ints. We recently updated the backend manager to match numpy by renamingaxes
toaxis
, but unexpectedly do not accept a single int as the singular name implies. Even stranger,np.sum(..., axis=[1, 2])
fails becauseaxis
must be a tuple and not a list. We cast to tuple internally so that usage is alright withmrmustard.math.sum
.Description of the Change:
Accept single ints as well as sequences of ints.
Benefits:
mrmustard.math.sum
better matches the backend library conventions.Possible Drawbacks:
N/A
PR Type
Bug fix, Enhancement
Description
Updated
math.sum
to accept single integers foraxis
.Replaced list-based
axis
arguments with integers or tuples across the codebase.Improved compatibility with backend libraries by aligning
math.sum
behavior.Adjusted related tests to reflect the updated
axis
handling.Changes walkthrough 📝
6 files
Updated `math.sum` calls to use integer `axis`.
Replaced list-based `axis` with integer in `math.sum`.
Fixed `math.sum` usage with integer `axis`.
Replaced list-based `axis` with integer in `math.sum`.
Updated `math.sum` to use integer `axis`.
Fixed `math.sum` usage with integer `axis`.
3 files
Enhanced `math.sum` to accept int or sequence for `axis`.
Updated `math.sum` to support int or sequence for `axis`.
Adjusted `math.sum` to handle int or tuple for `axis`.
1 files
Adjusted test to reflect updated `math.sum` behavior.