RFC: add logsumexp
#596
Labels
API extension
Adds new functions or objects to the API.
RFC
Request for comments. Feature requests and proposed changes.
This RFC seeks to include a new API in the array API specification for the purpose of computing the log of summed exponentials.
Overview
The Array API specification currently includes
logaddexp
which performs an element-wise operation on two input arrays, but does not include the reductionlogsumexp
. This API is commonly implemented in accelerator libraries for better numerical stability in deep learning applications.array-api/src/array_api_stubs/_2022_12/elementwise_functions.py
Line 1533 in 3d91878
This can be implemented using
log(sum(exp))
; however, such an implementation is not likely to be numerically stable.Prior art
logaddexp.reduce
.scipy.special
namespace.torch.special
: https://pytorch.org/docs/stable/special.html#torch.special.logsumexp)Proposal:
dtype
kwarg is for consistency withsum
et alRelated
cc @kgryte
The text was updated successfully, but these errors were encountered: