Re:NumPy Illustrated: The Visual Guide to NumPy
by throwawayiionqz on Tuesday December 29, 2020 @07:25AM
(#25569076)
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.
Re:NumPy Illustrated: The Visual Guide to NumPy
by evanb on Tuesday December 29, 2020 @08:33AM
(#25569583)
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.
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.