Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Basic Guide to Einsum (ajcr.net)
4 points by highfrequency 7 months ago | hide | past | favorite | 1 comment


If you find yourself needing einsum a lot, consider using the Xarray [1] package instead, which lets you name the axes of your arrays. Broadcasting and axis alignment is then automatically done by matching names. You don't need einsum then usually, since you can just use "dot" or "sum". However, if you do need einsum or other functions from NumPy, you can easily drop down to the NumPy level and re-add the Xarray metadata when you're done.

[1] https://xarray.dev




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

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

Search: