flâneur — a map of the web's best reading

Einsum is easy and useful | Erik Jenner

ejenner.com · 1,938 words · saved by 1 readers

`einsum` is one of the most useful functions in Numpy/Pytorch/Tensorflow and yet many people don't use it. It seems to have a reputation as being difficult to understand and use, which is completely backwards in my view: the reason `einsum` is great is precisely because it is *easier* to use and reason about than the alternatives. So this post tries to set the record straight and show how simple `einsum` really is.

einsum is one of the most useful functions in Numpy/Pytorch/Tensorflow and yet many people don’t use it. It seems to have a reputation as being difficult to understand and use, which is completely backwards in my view: the reason einsum is great is precisely because it is easier to use and reason about than the alternatives. So this post tries to set the record straight and show how simple einsum really is. The general syntax for einsum is einsum ( "some string describing an operation" , tensor_1 , tensor_2 , . . . ) with an arbitrary number of tensors after the string. (I’ll be saying “tensor

Explore this link on the map →

related reading