Add apply_over_axes API#8177
Conversation
| xp.apply_along_axis(xp.sum, axis, a) | ||
|
|
||
|
|
||
| class TestApplyOverAxes(unittest.TestCase): |
There was a problem hiding this comment.
Could you add another test for axes.ndim == 0 for coverage?
There was a problem hiding this comment.
add test_apply_over_axis_invalid_0darr
Co-authored-by: Akifumi Imanishi <[email protected]>
Co-authored-by: Akifumi Imanishi <[email protected]>
Co-authored-by: Akifumi Imanishi <[email protected]>
| for xp in [numpy, cupy]: | ||
| a = xp.array(42) | ||
| with pytest.raises(AttributeError): | ||
| xp.apply_over_axes(xp.sum, a, 0) |
There was a problem hiding this comment.
This line should not raise AttributeError.
There was a problem hiding this comment.
I've Changed it into numpy.AxisError
|
I found that cupy behaves different from numpy in 0-demension array. cupy will throw an AxisError: But numpy will not throw an error: The key difference is that cupy uses: but numpy uses I will make the behavior the same with numpy. But also add a comment on there. |
|
HI, I have fixed all the problems. Would you like to take a look? |
|
@syheliel Could you fix for CI failures? |
|
This pull request is now in conflicts. Could you fix it @syheliel? 🙏 |
|
got it, I will fix it later |
|
CIs are still failing. We can provide assistance if needed. 😃 |
|
@asi1024 thanks! I have located where is the problem and I'm trying to fix/test it on my local machine |
|
I've fixed the flake8 problem. But I can't find a way to fix this in doc: Would you like take a look? |
|
This pull request is now in conflicts. Could you fix it @syheliel? 🙏 |
|
Are the only blockers docs and conflicts? |
Co-authored-by: Akifumi Imanishi <[email protected]>
|
/test mini |
kmaehashi
left a comment
There was a problem hiding this comment.
For NumPy v2 compatibility.
|
/test mini |
kmaehashi
left a comment
There was a problem hiding this comment.
For NumPy v1 compatibility (currently CI uses NumPy v1)
|
/test mini |
Hello, the community! This PR is to contribute a little step forward #6078. It's my first time to get involved in
cupy:)implement Code is from: https://github.com/numpy/numpy/blob/8f7e4c57931569760a036599ade6955ecc387c84/numpy/lib/_shape_base_impl.py#L413
Test code is from: https://github.com/numpy/numpy/blob/8f7e4c57931569760a036599ade6955ecc387c84/numpy/lib/tests/test_shape_base.py#L274