opt-einsum
Path optimization of einsum functions.
Decision gist · record as of 2026-08-14
Yes, if you work with multi-tensor contractions. The installation is frictionless with no dependencies. The dormant maintenance status (687 days since last release) is a minor concern for long-term compatibility, but the package is marked Production/Stable and has no known vulnerabilities. Install it as a performance tool for existing einsum code rather than as a foundation for new architecture.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low friction installation with no runtime dependencies.
- Maintenance is dormant (687 days since last release), though the package is marked Production/Stable and supports current Python versions.
License · maintenance · safety
permissive license (permissive) — MIT license (permissive) allows use in both open-source and commercial projects with minimal restrictions.
last release 2024-09-26 (687 days)
0 known vulnerabilities (OSV.dev, 2026-08-14) · 25,245,905 downloads/mo, #904 on PyPI
Alternatives
Verify before relying
pip install opt_einsum
from opt_einsum import contract
result = contract('pi,qj,ijkl,rk,sl->pqrs', C, C, I, C, C)- Whether dormant maintenance status affects long-term compatibility with newer array library versions
- Performance gains on modern hardware and with current optimization strategies in supported backends
- Specific performance improvements achievable on typical workloads compared to native einsum implementations
What it is and what it does
opt_einsum is a tensor contraction optimizer that reorders einsum operations to minimize intermediate tensor sizes and computation steps. Rather than executing a contraction in the order specified, it analyzes the expression and finds a more efficient path. The package works as a drop-in replacement for einsum functions across supported backends, automatically dispatching work to canonical BLAS, cuBLAS, or other specialized routines when possible.
It is primarily used in scientific computing and machine learning workflows where large tensor operations are common. The package supports inspecting optimization paths, reusing compiled expressions with constant tensors, handling hundreds or thousands of tensors in a single contraction, and computing gradients through supported autodiff libraries. With no runtime dependencies and support for Python 3.8 and later, it integrates cleanly into existing numerical codebases.
Use it for
- Speed up large tensor contractions in scientific simulations by automatically finding better computation order
- Optimize model computations involving complex multi-tensor operations across supported backends
- Compile and reuse contraction expressions with fixed tensor shapes for repeated high-performance computations
- Debug and inspect the contraction path chosen by einsum to understand performance bottlenecks
- Handle gradient computation through tensor contractions using supported autodiff frameworks
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you work with multi-tensor contractions.
The installation is frictionless with no dependencies. The dormant maintenance status (687 days since last release) is a minor concern for long-term compatibility, but the package is marked Production/Stable and has no known vulnerabilities. Install it as a performance tool for existing einsum code rather than as a foundation for new architecture.
Install
opt-einsum on PyPI
Before you install
Low friction installation with no runtime dependencies. Maintenance is dormant (687 days since last release), though the package is marked Production/Stable and supports current Python versions.
License in practice
MIT license (permissive) allows use in both open-source and commercial projects with minimal restrictions.
Quickstart
pip install opt_einsum
from opt_einsum import contract
result = contract('pi,qj,ijkl,rk,sl->pqrs', C, C, I, C, C)
Verify before relying
- Whether dormant maintenance status affects long-term compatibility with newer array library versions
- Performance gains on modern hardware and with current optimization strategies in supported backends
- Specific performance improvements achievable on typical workloads compared to native einsum implementations
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >=3.8 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Dormant 687 days since the last release |
| First released | |
| Downloads | 25,245,905 / month, #904 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: Science/ResearchLicense :: OSI Approved :: MIT LicenseProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Libraries :: Python Modules |
Evidence: opt_einsum-3.4.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “tensor contraction order”
- opt-einsumOptimizes the contraction order of einsum expressions to dramatically…
- cotengraCotengra optimizes the contraction order of large tensor networks and…
- opt-einsum-fxOptimizes PyTorch einsum operations and functions containing them by…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also cotengra · opt-einsum-fx · einx · einops · contractions · spo4onnx · accelforge · tensorflow-model-optimization · einshape · autoray