Hacker News new | ask | show | jobs
by bonoboTP 1996 days ago
It's simple. It's the axis that will disappear (or become length 1 with keepdims) after performing the operation.
1 comments

It's not simple because there are two axis of interest: the axis along you sum, and the axis that are preserved (ie, that gives the dimension of the returned array).

Both of them are of interest and after you were confused once about which one to supply to axis=..., there is no way back to clear the confusion. With einsum there is no confusion.

If you have a high-dimensional array then in your latter convention if you had to specify the “remaining” axes you’d need to provide a lengthy list. That’d be user-hostile.