Path optimization of einsum functions.
Slowing down. Last release over 2 years ago, little activity since. Fine for existing code; think twice for a new project.
pip install opt-einsumOptimized Einsum
Optimized Einsum: A tensor contraction order optimizer
Optimized einsum can significantly reduce the overall execution time of einsum-like expressions (e.g.,
np.einsum,
dask.array.einsum,
pytorch.einsum,
tensorflow.einsum,
)
by optimizing the expression's contraction order and dispatching many
operations to canonical BLAS, cuBLAS, or other specialized routines.
Optimized einsum is agnostic to the backend and can handle NumPy, Dask, PyTorch, Tensorflow, CuPy, Sparse, Theano, JAX, and Autograd arrays as well as potentially any library which conforms to a standard API. See the documentation for more information.
Example usage
The opt_einsum.contract
function can often act as a drop-in replacement for
functions without further changes to the code while providing superior performance.
Here, a tensor contraction is performed with and without optimization: