Live data from Hacker News

Einsum in Depth

einsum.joelburget.com

31–33 of 33 posts

Re: Einsum in Depth

#31
post #26

Earlier quoted context omitted.

I had been working on a library for visualizing tensor contractions (so-called Penrose tensor diagrams), https://github.com/Quantum-Flytrap/tensor-diagrams , with an example (a tutorial stub) https://p.migdal.pl/art-tensor-diagrams/ . My background is in quantum physics, and it is a useful tool for understanding some aspects of entanglement. Here, the idea was to show its use in machine learning in general and deep l…

Awesome! Are you able to handle sums of diagrams like (-M- + -a b-)-c etc?

Thanks! Right now, it does not.

I focus on a common case of a single product without any other parts. If there is a summation, it is managed via indices.

If you are interested in arbitrary drawings, you are probably aware of TikZ (if you like coding) or Excalidraw.

Re: Einsum in Depth

#32
post #27

Earlier quoted context omitted.

There are some libraries, but the style is so not standardized that I understand your desire to write your own. Back in 2020 I wanted to write a library based on manim to animate the contractions, but I never came around to it (and manim back then was less well-documented than it is now).

> There are some libraries, but the style is so not standardized that I understand your desire to write your own. Do you have some recommendations? I'm currently using tikz' graphdrawing library because it supports subgraphs. This is necessary for handling addition, functions and derivatives. However, the force-based layouting doesn't work with subgraphs, which causes a lot of trouble. > Back in 2020 I wanted to writ…

I don't have specific recommendations, I mostly use libraries to draw quantum computing circuits, but they're not great for tensor networks even though they share some features. Man, we think alike. Btw, I've seen you work with Patrick, we used to share an office at the IQC (we were both postdocs there), tell him I said hi! :)

Re: Einsum in Depth

#33
post #15

For anyone who does a lot of einsum I highly recommend the einx package because the stock single-letter syntax very quickly becomes hard to read.

In your experience, why einx over einops+einsum?

I didn't try einops, just went to einx because the interface seemed cleaner. I do think that some of its more "powerful" features do lead to cryptic expressions once again, so I avoid them.
Post reply on HN