[Breaking Change] Implement argsort and make sort numpy API compliant - #2386
Conversation
…analytics/heat into 777-Implement_argsort
- Fixed argsort test. - Fixed sort calls for old the sort API
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Thanks! I think it's a good idea to be closer to Numpy and to support argsort. However, I don't think we should silently ignore additional arguments that Numpy users are used to.
Note that the errors in the collection step in pytest happen all over the place, including in other repositories, and have nothing to do with this PR.
|
Excellent! If you apply something similar to |
for more information, see https://pre-commit.ci
brownbaerchen
left a comment
There was a problem hiding this comment.
Thanks! I think we can clean up the tests a bit more. Otherwise, this is ready in my opinion.
|
The current tests fail, due to an API change in numpy 2.5, which added the |
That's annoying! I think the best we can do is to split the tests into ones with class Tests(...):
@unittest.skipif(np.lib.NumpyVersion(np.__version__) < '2.5.0', f'Numpy version {np.__version__} does not support `descending` keyword in `sort`)
def test_sort(self):
...
def test_sort_no_descending_argument(self):
...Alternatively, you can use the |
- Switched to pytest for testing of sorting.
for more information, see https://pre-commit.ci
- Removed descending parameter from keyword when not supported.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2386 +/- ##
==========================================
- Coverage 91.81% 91.74% -0.08%
==========================================
Files 87 87
Lines 14149 14168 +19
==========================================
+ Hits 12991 12998 +7
- Misses 1158 1170 +12
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
brownbaerchen
left a comment
There was a problem hiding this comment.
Sorry, I have a few more small points, but should be quick to address 🙈
Co-authored-by: Thomas Saupe <39156931+brownbaerchen@users.noreply.github.com>
brownbaerchen
left a comment
There was a problem hiding this comment.
Feel free to remove any unnecessary tests, or not. Otherwise, we can finally merge :D
|
The failures in previous pushes look unrelated to this.. No idea what's going on there... :( |
|
@brownbaerchen, I removed the specific test. The codebase test fails due to not enough storage. If everything is fine, you can merge it. |
Let's merge! @JuanPedroGHM, do you have some bandwidth for looking into why we are suddenly running out of disk space on codebase during installation? |
Due Diligence
Description
argsortandsorthave been changed to reflect the Numpy API, while also allowing old usage.Issue/s resolved: #777
Type of change
Does this change modify the behaviour of other functions? If so, which?
yes,
sortnow does not give back the indices when sorting like pytorch. Instead a flag must be given to achieve same behaviour.