🎩🤓 Look out, math nerds! The life's work of countless physicists has been distilled into a "simple trick" for backpropagating through #einsum, which we all know is basically just fancy #emoji math. Grab your #numpy and prepare to be dazzled by the groundbreaking revelation that i, j, and k were *not* just randomly chosen letters! 🙄🔍
https://tripplyons.com/blog/backprop-trick #mathnerds #backpropagation #physics #HackerNews #ngated
A Trick for Backpropagation of Linear Transformations

Linear transformations such as sums, matrix products, dot products, Hadamard products, and many more can often be represented using an [einsum](https://numpy.org/doc/stable/reference/generated/numpy.

This morning I had an operation to do on a 3000x3000 matrix. I start by writing a dirty old triple nested loop... estimated time by tqdm: 3h30.

Ok let's rewrite this as an einsum.

16 seconds.

Wait what?

Double checking everything on smaller matrices. Everything checks out 😮

#numpy #einsum

Have you ever wanted to name your variables in NumPy's Einsum and use these names as keyword arguments? Neinsum is waiting for you.

https://github.com/adtzlr/named-einsum

#numpy #python #einsum #computationalmechanics #scientificcomputing #opensource

GitHub - adtzlr/named-einsum: NumPy's Einsum, but with named subscripts.

NumPy's Einsum, but with named subscripts. Contribute to adtzlr/named-einsum development by creating an account on GitHub.

GitHub
GitHub - termoshtt/einsum-derive: Proc-macro based einsum implementation for rust-ndarray

Proc-macro based einsum implementation for rust-ndarray - GitHub - termoshtt/einsum-derive: Proc-macro based einsum implementation for rust-ndarray

GitHub