einshape
DSL-based reshaping library for JAX and other frameworks
Decision gist · record as of 2026-08-14
Yes, if you perform frequent tensor reshaping and want more readable transformation code. The DSL is expressive and reduces boilerplate. However, maintenance is dormant (last release 2022-12-19); verify compatibility with your framework version before adopting in production. For occasional reshaping, native operations may be simpler.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- A compatible tensor framework (JAX or TensorFlow) must be installed separately; einshape does not declare either as a dependency to remain framework-agnostic.
- Low friction installation with a pure-Python wheel.
- Maintenance is dormant—last release was 2022-12-19 with no updates since, though the repository remains active with a recent commit on 2024-06-25.
License · maintenance · safety
Apache 2.0 (permissive) — Apache 2.0 is permissive, allowing commercial and private use with minimal restrictions. You may use, modify, and distribute the package freely provided you include the license notice.
last release 2022-12-19 (1334 days) · last repo commit 2024-06-25 · 111 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 533,200 downloads/mo, #6,142 on PyPI
Alternatives
Verify before relying
from einshape import jax_einshape as einshape
import numpy as np
a = np.array([[1, 2], [3, 4]])
b = einshape("ij->(ij)", a)
# b is [1, 2, 3, 4]- Whether the dormant maintenance status affects compatibility with recent framework releases.
- Performance characteristics compared to native reshape and transpose operations.
- Full scope of equation syntax support beyond the documented examples.
What it is and what it does
Einshape is a DSL-based tensor manipulation library that unifies reshape, squeeze, expand_dims, and transpose operations under a single Einstein-notation-inspired syntax. Instead of chaining multiple function calls or computing permutation indices, you write compact equations like "nhwc->nchw" to transpose or "(mn)hwc->mnhwc" to split dimensions, making complex tensor transformations more readable and less error-prone.
The library works across multiple frameworks by exposing both a high-level API for each and a lower-level parser and engine for custom implementations. It supports advanced features like ellipsis (...) for variable-rank tensors, grouping syntax for dimension factorization, and unit dimensions for squeeze and expand operations. You supply dimension sizes via keyword arguments when they cannot be inferred from the equation.
Use it for
- Reorder tensor axes for model input formats without manually computing permutation indices.
- Reshape batch and feature dimensions in a single readable operation instead of chained calls.
- Expand or squeeze unit dimensions using compact notation rather than repeated function calls.
- Split or combine dimensions with automatic size inference from keyword arguments.
- Write framework-agnostic tensor transformation code using the parser and engine.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you perform frequent tensor reshaping and want more readable transformation code.
The DSL is expressive and reduces boilerplate. However, maintenance is dormant (last release 2022-12-19); verify compatibility with your framework version before adopting in production. For occasional reshaping, native operations may be simpler.
Install
einshape on PyPI
Before you install
Low friction installation with a pure-Python wheel. Maintenance is dormant—last release was 2022-12-19 with no updates since, though the repository remains active with a recent commit on 2024-06-25.
A compatible tensor framework (JAX or TensorFlow) must be installed separately; einshape does not declare either as a dependency to remain framework-agnostic.
License in practice
Apache 2.0 is permissive, allowing commercial and private use with minimal restrictions. You may use, modify, and distribute the package freely provided you include the license notice.
Quickstart
from einshape import jax_einshape as einshape
import numpy as np
a = np.array([[1, 2], [3, 4]])
b = einshape("ij->(ij)", a)
# b is [1, 2, 3, 4]
Verify before relying
- Whether the dormant maintenance status affects compatibility with recent framework releases.
- Performance characteristics compared to native reshape and transpose operations.
- Full scope of equation syntax support beyond the documented examples.
Package facts
| License | Apache 2.0 permissive |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 3 packagesabsl-pynumpydataclasses |
| Maintenance | Dormant 1,334 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 533,200 / month, #6,142 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
Evidence: einshape-1.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 reshape DSL”
- einshapeEinshape provides a DSL-based interface for tensor reshaping,…
- einopsEinops provides readable tensor operations (rearrange, reduce,…
- nvidia-cutlass-dsl-libs-cu12Provides a Python DSL for writing high-performance CUDA kernels using…
Give your agent the search over MCP, or paste the wish link into any chat.
More Scientific/Engineering packages
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
pandas provides fast, flexible data structures (Series and DataFrame) for loading, cleaning, transforming, and analyzing labeled or relational data in Python.
scipy provides numerical algorithms for mathematics, science, and engineering—including optimization, integration, linear algebra, Fourier transforms, signal and image processing, and ODE solvers—built on numpy arrays.
scikit-learn provides a comprehensive Python library for supervised and unsupervised machine learning, including classification, regression, clustering, dimensionality reduction, and model evaluation tools built on NumPy and SciPy.
Install it if you need to train, evaluate, or deploy supervised or unsupervised learning models.
dill extends Python's pickle module to serialize and deserialize a much wider range of Python objects, including functions, lambdas, classes, and interpreter sessions, to byte streams for storage or network transmission.
Multiprocess is an enhanced fork of Python's standard multiprocessing library that uses dill for better serialization, allowing you to spawn processes with a threading-like API and share complex objects between them.
Install it if you use multiprocessing and encounter pickle serialization limits with lambdas or complex objects.
See also einx · jaxtyping · einops · diffrax · tensordict · transformations · tensordict-nightly · tensorly · einops-exts · fast-array-utils