opt-einsum

Optimizing numpys einsum function

Here are some articles that you may find helpful