Hacker News new | past | comments | ask | show | jobs | submit login

I think einsum is great but it's a bit like regex in that it's unnecessarily concise and hard to read. I use a wrapper where you can name the axes anything you like, eg. "index", "world", "cam", and it translates it to the single letters.

Even better is if the library keeps track of the names of the tensor axes and the einsum is automatic.




Not sure if the wrapper you’re talking about is your own custom code, but I really like using einops lately. It’s got similar axis naming capabilities and it dispatches to both numpy and pytorch

http://einops.rocks/


I just made my own function but that sounds great, I'll check it out!


I totally agree. Here's a library that basically does that: https://docs.xarray.dev/en/stable/




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: