Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

`cupy` `repeat` does not accept CuPy array for `repeats`

Open
#312 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
python
Domain
data

Research direction

Start by running the reported Python example for xp.repeat(x, x) with CuPy and compare it with array_api_strict. Read the Array API repeat specification and CuPy issue #3849 to determine whether the compatibility layer should handle array-valued repeats or document the limitation; done means reaching a clear decision and adding coverage if a change is warranted.

Written by the indexing model from the issue text.

Description

blocked by upstream

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 https://github.com/cupy/cupy/issues/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.

Dominant language
Python
Stars
131
Forks
49
Avg merge
2d 8h
Merged PRs (30d)
6

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from data-apis/array-api-compat

All issues in data-apis/array-api-compat

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.