-
Notifications
You must be signed in to change notification settings - Fork 52
Open
Labels
API extensionAdds new functions or objects to the API.Adds new functions or objects to the API.RFCRequest for comments. Feature requests and proposed changes.Request for comments. Feature requests and proposed changes.
Milestone
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.
- log2:
def log2(x: array, /) -> array:
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
- MXNet: (Not currently implemented)
- TensorFlow: https://www.tensorflow.org/api_docs/python/tf/experimental/numpy/exp2
- C99: https://en.cppreference.com/w/c/numeric/math/exp2
Proposal:
def exp2(x: array, /) -> array
cc @kgryte
Metadata
Metadata
Assignees
Labels
API extensionAdds new functions or objects to the API.Adds new functions or objects to the API.RFCRequest for comments. Feature requests and proposed changes.Request for comments. Feature requests and proposed changes.