RFC: add `exp2` function to the standard
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- python
- Domain
- api, documentation
Research direction
Start by reading the array API specification and the referenced elementwise_functions.py definition for log2, then compare the common_apis.csv entry and linked prior-art implementations. Done means reaching a project decision on whether exp2 belongs in the standard and documenting the accepted API consistently with the existing specification.
Written by the indexing model from the issue text.
Description
This RFC requests to include a new API in the array API specification for the purpose of computing the base-2 exponential.
Overview
Based on array comparison data, the API is available in the majority of libraries in the PyData ecosystem.
The Array API specification currently includes log2, exp, and pow, but does not include the IEEE 754 function exp2. Would be nice to add for completeness.
While this can currently be achieved now by using pow, exp2 is commonly implemented as a slightly more ergonomic perf path.
Prior art
- NumPy: https://numpy.org/doc/stable/reference/generated/numpy.exp2.html
- PyTorch: https://pytorch.org/docs/stable/generated/torch.exp2.html
- TensorFlow: https://www.tensorflow.org/api_docs/python/tf/experimental/numpy/exp2
- JAX: https://docs.jax.dev/en/latest/_autosummary/jax.numpy.exp2.html#jax.numpy.exp2
- CuPy: https://docs.cupy.dev/en/stable/reference/generated/cupy.exp2.html
- Dask: https://docs.dask.org/en/stable/generated/dask.array.exp2.html
- ndonnx: (Not currently implemented)
- C99: https://en.cppreference.com/w/c/numeric/math/exp2
Proposal:
def exp2(x: array, /) -> array
cc @kgryte
- Dominant language
- Python
- Stars
- 281
- Forks
- 52
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from data-apis/array-api
-
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
Maintenance
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
All issues in data-apis/array-api
Similar issues
-
documentation help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
simonw/sqlite-utils#872 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100