Use JIT compiler to back `cupy.fromfunction()`
- Dominant language
- Python
- Stars
- 12.3k
- Forks
- 1.1k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 45
Description
### Description
#5925 added a bunch of NumPy-compliant functions, including `cupy.fromfunction()`. However, it is suboptimal as `numpy.fromfunction` is called internally.
It'd be nice to take the same JIT capability behind `cupy.vectorize()` and make it work with `fromfunction`. However, a common usage of `fromfunction` [seems to involve lambda functions](https://numpy.org/doc/stable/reference/generated/numpy.fromfunction.html), which CuPy does not support yet (#4290). Not sure if this is a blocker, though.
### Additional Information
_No response_
Contributor guide
Research direction
Start by reading the cupy.fromfunction implementation added in #5925 and the JIT path behind cupy.vectorize(); compare their behavior with numpy.fromfunction, including the lambda limitation tracked in #4290. Done means fromfunction no longer relies on numpy.fromfunction internally and its supported behavior is covered by appropriate tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend-api-design, performance
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100