-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Support array objects as the repeats argument to cupy.repeat #3849
Copy link
Copy link
Open
Labels
cat:enhancementImprovements to existing featuresImprovements to existing featuresst:needs-discussion
Description
For consistency with NumPy, it would be nice to allow passing a CuPy array (or perhaps an ndarray-like object) as the repeats= argument to cupy.repeat.
I can do the following with NumPy:
import numpy as np
np.repeat(a=np.arange(3), repeats=np.array([2,2,2]))
array([0, 0, 1, 1, 2, 2])But the analogous action is not implemented for CuPy:
cupy/cupy/core/_routines_manipulation.pyx
Lines 466 to 468 in 3c4f481
| if isinstance(repeats, ndarray): | |
| raise ValueError( | |
| 'cupy.ndaray cannot be specified as `repeats` argument.') |
It's required to be an integer, list, or tuple.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
cat:enhancementImprovements to existing featuresImprovements to existing featuresst:needs-discussion