Skip to content

cupy repeat does not accept CuPy array for repeats #312

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mdhaber opened this issue Apr 18, 2025 · 0 comments
Open

cupy repeat does not accept CuPy array for repeats #312

mdhaber opened this issue Apr 18, 2025 · 0 comments

Comments

@mdhaber
Copy link

mdhaber commented Apr 18, 2025

The standard specifies that the second argument of repeat ("repeats") can be an array of integers, but CuPy doesn't support this.

from array_api_compat import cupy as xp  # not OK
# import array_api_strict as xp  # OK

x = xp.asarray([1, 2, 3])
xp.repeat(x, x)
# ValueError: cupy.ndaray cannot be specified as `repeats` argument.

The array API documentation of repeats notes:

For specification-conforming array libraries supporting hardware acceleration, providing an array for repeats may cause device synchronization due to an unknown output shape. For those array libraries where synchronization concerns are applicable, conforming array libraries are advised to include a warning in their documentation regarding potential performance degradation when repeats is an array.

From cupy/cupy#3849, I see that this is the case for CuPy. Not sure what that means for this issue. One could argue that CuPy does not support it and that this can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants