Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: