Fix for NumPy 1.23#6807
Conversation
|
For CuPy v11, I'd follow NumPy 1.23's behavior by removing these lines cupy/cupy/_core/_routines_indexing.pyx Lines 259 to 270 in 16b511f |
|
Sure! (I completely had misunderstanding about that...) |
|
/test mini |
|
/test mini |
|
/test mini |
| {'shape': (0,), 'indexes': True}, | ||
| {'shape': (0,), 'indexes': (True,)}, | ||
| {'shape': (0,), 'indexes': numpy.ones((), dtype=numpy.bool_)}, | ||
| {'shape': (0,), 'indexes': numpy.zeros((), dtype=numpy.bool_)}, |
There was a problem hiding this comment.
These tests were split from TestArrayAdvancedIndexingGetitemParametrized in #1503 for NumPy 1.13 support, so I've made them back there in this PR as numpy<1.13 is already dropped.
| {'shape': (0,), 'indexes': True, 'value': 1}, | ||
| {'shape': (0,), 'indexes': (True,), 'value': 1}, | ||
| {'shape': (0,), 'indexes': numpy.ones((), dtype=numpy.bool_), 'value': 1}, | ||
| {'shape': (0,), 'indexes': numpy.zeros((), dtype=numpy.bool_), 'value': 1}, |
There was a problem hiding this comment.
These tests were split from TestArrayAdvancedIndexingSetitemScalarValue in #1503 for NumPy 1.13 support, so I've made them back there in this PR as numpy<1.13 is already dropped.
| ast.Sub: arithmetic.subtract, | ||
| ast.Mult: arithmetic.multiply, | ||
| ast.Pow: arithmetic.power, | ||
| ast.Div: _numpy_scalar_true_divide, |
There was a problem hiding this comment.
Seems that we don't need _numpy_scalar_true_divide anymore.
There was a problem hiding this comment.
It seems so to me, too.
@asi1024 Do you have any comment?
There was a problem hiding this comment.
I agree to use arithmetic.true_divide!
|
@toslunar, do you think this can be in the RC release this Thursday? If needed I think it's worth delaying the release, as v11 is a goog chance to bump the API baseline version to v1.23. |
toslunar
left a comment
There was a problem hiding this comment.
LGTM
I left some minor comments that seem optional to be fixed in this PR.
cupy/_core/core.pyx
Outdated
| DeprecationWarning) | ||
| axis = 0 | ||
| else: | ||
| # Don't mention the deprecated F-contiguous support |
There was a problem hiding this comment.
nit: This line can be removed, too.
| st = 1 | ||
|
|
||
| # For some cases, the strides are all set to zero if the shape is | ||
| # zero-sized since NumPy 1.23. |
There was a problem hiding this comment.
Do you know whether NumPy intentionally kept the behavior for no copy reshape? Maybe it's good to report to NumPy.
There was a problem hiding this comment.
No, I couldn't search the source enough last night. As you say, it's a kind of weird behavior. I'm going to see it again.
There was a problem hiding this comment.
It seems the change in creation (zero strides) was introduced in numpy/numpy#21477 (ctors.c). numpy/numpy#21477 (review)
| ast.Sub: arithmetic.subtract, | ||
| ast.Mult: arithmetic.multiply, | ||
| ast.Pow: arithmetic.power, | ||
| ast.Div: _numpy_scalar_true_divide, |
There was a problem hiding this comment.
It seems so to me, too.
@asi1024 Do you have any comment?
|
/test mini |
|
v10 fix will be |
Rel #6764.