-
-
Notifications
You must be signed in to change notification settings - Fork 12.2k
Closed
Description
Should logaddexp and logaddexp2 have identities defined for reduce?
In [1]: x = np.array([-1,-1,-1], dtype=float)
In [2]: np.logaddexp2.reduce(x)
Out[2]: 0.58496250072115619
In [3]: np.logaddexp2.reduce(x[:2]) # matches np.logaddexp2(*x[:2])
Out[3]: 0.0
In [4]: np.logaddexp2.reduce(x[:1])
Out[4]: -1.0
In [5]: np.logaddexp2.reduce(x[:0])
ValueError: zero-size array to reduction operation logaddexp2 which has no identity
I was expecting -inf when reducing an empty array.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels