Open
Description
Repeat only accepts int or int array for repeats, np.uint is not accepted. But the function still checks if repeats are negative. I am working with nonegative values this becomes an unnecessary conversion step.
Reproducing code example:
import numpy as np
x = np.array([1,2,3,4])
r = np.array([1,0,0,2], dtype=np.uint)
x.repeat(r)
Error message:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-2-9ac14301bd8a> in <module>
2 x = np.array([1,2,3,4])
3 r = np.array([1,0,0,2], dtype=np.uint)
----> 4 x.repeat(r)
TypeError: Cannot cast array data from dtype('uint64') to dtype('int64') according to the rule 'safe'
Numpy/Python version information:
1.17.4 3.8.2 (default, Mar 13 2020, 10:14:16)
[GCC 9.3.0]
Metadata
Metadata
Assignees
Labels
No labels