einx  by fferflo

Tensor operation library using Einstein-inspired notation

Created 2 years ago
484 stars

Top 63.4% on SourcePulse

GitHubView on GitHub
Project Summary

einx is a Python library providing a unified interface for tensor operations across NumPy, PyTorch, JAX, and TensorFlow, using an Einstein-inspired notation. It aims to simplify complex tensor manipulations, particularly for neural network development, by offering a consistent and composable syntax for operations like summation, reshaping, and matrix multiplication.

How It Works

einx employs a novel notation inspired by einops but introduces bracket notation and full composability for a universal tensor language. Operations are defined using this notation, which is then just-in-time compiled into optimized backend-specific Python functions using exec(). This approach allows for seamless integration with existing codebases and efficient execution by reducing overhead through caching.

Quick Start & Requirements

  • Install via pip: pip install einx
  • Requires Python. Supports NumPy, PyTorch, JAX, and TensorFlow backends.
  • See Installation for more details.

Highlighted Details

  • Universal notation for tensor operations across multiple frameworks.
  • Supports advanced operations like grouped and spatial matrix multiplications.
  • Integrates deep learning modules for PyTorch, Flax, Haiku, Equinox, and Keras.
  • Just-in-time compilation for optimized performance and inspectable code generation.

Maintenance & Community

  • Actively maintained by the einx team.
  • Examples and tutorials are available for various deep learning models and frameworks.
  • See examples/train_torch.py for example training.

Licensing & Compatibility

  • MIT License. Permissive for commercial use and integration with closed-source projects.

Limitations & Caveats

  • The library relies on Python's exec() for JIT compilation, which might have security implications in untrusted environments.
  • While aiming for universality, the complexity of the notation might require a learning curve for new users.
Health Check
Last Commit

1 week ago

Responsiveness

Inactive

Pull Requests (30d)
3
Issues (30d)
1
Star History
11 stars in the last 30 days

Explore Similar Projects

Starred by Andrej Karpathy Andrej Karpathy(Founder of Eureka Labs; Formerly at Tesla, OpenAI; Author of CS 231n), Edward Sun Edward Sun(Research Scientist at Meta Superintelligence Lab), and
5 more.

attorch by BobMcDear

0.2%
599
PyTorch nn module subset, implemented in Python using Triton
Created 2 years ago
Updated 8 months ago
Starred by Sasha Rush Sasha Rush(Research Scientist at Cursor; Professor at Cornell Tech), Jeremy Howard Jeremy Howard(Cofounder of fast.ai), and
3 more.

tensordict by pytorch

0.1%
1k
PyTorch tensor container for efficient ML data handling
Created 3 years ago
Updated 21 hours ago
Starred by Travis Addair Travis Addair(Cofounder of Predibase), Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems"), and
10 more.

hummingbird by microsoft

0.1%
4k
Compiler for trained ML models into tensor computation
Created 6 years ago
Updated 8 months ago
Starred by Nat Friedman Nat Friedman(Former CEO of GitHub), Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems"), and
15 more.

FasterTransformer by NVIDIA

0.0%
6k
Optimized transformer library for inference
Created 5 years ago
Updated 2 years ago
Starred by Bojan Tunguz Bojan Tunguz(AI Scientist; Formerly at NVIDIA), Alex Chen Alex Chen(Cofounder of Nexa AI), and
19 more.

ggml by ggml-org

0.3%
14k
Tensor library for machine learning
Created 3 years ago
Updated 2 days ago
Feedback? Help us improve.