All Projects → dgasmith → Opt_einsum

dgasmith / Opt_einsum

Licence: mit
⚡️Optimizing einsum functions in NumPy, Tensorflow, Dask, and more with contraction order optimization.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Opt einsum

Deepnet
Deep.Net machine learning framework for F#
Stars: ✭ 99 (-75.06%)
Mutual labels:  tensor, gpu-acceleration
Tvm
Open deep learning compiler stack for cpu, gpu and specialized accelerators
Stars: ✭ 7,494 (+1787.66%)
Mutual labels:  tensor, performance
Hyperformula
A complete, open-source Excel-like calculation engine written in TypeScript. Includes 380+ built-in functions. Maintained by the Handsontable team⚡
Stars: ✭ 210 (-47.1%)
Mutual labels:  gpu-acceleration, performance
Deepc
vendor independent deep learning library, compiler and inference framework microcomputers and micro-controllers
Stars: ✭ 260 (-34.51%)
Mutual labels:  tensor, performance
Sharp
High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, AVIF and TIFF images. Uses the libvips library.
Stars: ✭ 21,131 (+5222.67%)
Mutual labels:  performance
Plain Draggable
The simple and high performance library to allow HTML/SVG element to be dragged.
Stars: ✭ 362 (-8.82%)
Mutual labels:  performance
React Native Slowlog
A high-performance timer based profiler for React Native that helps you track big performance problems.
Stars: ✭ 363 (-8.56%)
Mutual labels:  performance
Reckless
Reckless logging. Low-latency, high-throughput, asynchronous logging library for C++.
Stars: ✭ 358 (-9.82%)
Mutual labels:  performance
Guider
Performance Analyzer
Stars: ✭ 393 (-1.01%)
Mutual labels:  performance
Objectbox Java
ObjectBox is a superfast lightweight database for objects
Stars: ✭ 3,950 (+894.96%)
Mutual labels:  performance
Awesome Wp Speed Up
Plugins and resources to speed up and optimize your WordPress site.
Stars: ✭ 375 (-5.54%)
Mutual labels:  performance
Ratel Core
High performance JavaScript to JavaScript compiler with a Rust core
Stars: ✭ 367 (-7.56%)
Mutual labels:  performance
Enlightn
Your performance & security consultant, an artisan command away.
Stars: ✭ 378 (-4.79%)
Mutual labels:  performance
Reflective Bind
Eliminate wasteful re-rendering in React components caused by inline functions
Stars: ✭ 366 (-7.81%)
Mutual labels:  performance
Megengine
MegEngine 是一个快速、可拓展、易于使用且支持自动求导的深度学习框架
Stars: ✭ 4,081 (+927.96%)
Mutual labels:  tensor
Vot Toolkit
Visual Object Tracking (VOT) challenge evaluation toolkit
Stars: ✭ 360 (-9.32%)
Mutual labels:  performance
Laps
Light WordPress profiler.
Stars: ✭ 368 (-7.3%)
Mutual labels:  performance
Laravel Model Cleanup
Clean up unneeded records
Stars: ✭ 388 (-2.27%)
Mutual labels:  performance
Lissajous
🎵 A tool for programmatic audio performance in the browser using Javascript.
Stars: ✭ 367 (-7.56%)
Mutual labels:  performance
Loopy
A code generator for array-based code on CPUs and GPUs
Stars: ✭ 367 (-7.56%)
Mutual labels:  performance

Optimized Einsum

Build Status codecov Anaconda-Server Badge PyPI PyPIStats Documentation Status DOI

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 einsum functions without further changes to the code while providing superior performance. Here, a tensor contraction is preformed with and without optimization:

import numpy as np
from opt_einsum import contract

N = 10
C = np.random.rand(N, N)
I = np.random.rand(N, N, N, N)

%timeit np.einsum('pi,qj,ijkl,rk,sl->pqrs', C, C, I, C, C)
1 loops, best of 3: 934 ms per loop

%timeit contract('pi,qj,ijkl,rk,sl->pqrs', C, C, I, C, C)
1000 loops, best of 3: 324 us per loop

In this particular example, we see a ~3000x performance improvement which is not uncommon when compared against unoptimized contractions. See the backend examples for more information on using other backends.

Features

The algorithms found in this repository often power the einsum optimizations in many of the above projects. For example, the optimization of np.einsum has been passed upstream and most of the same features that can be found in this repository can be enabled with np.einsum(..., optimize=True). However, this repository often has more up to date algorithms for complex contractions.

The following capabilities are enabled by opt_einsum:

Please see the documentation for more features!

Installation

opt_einsum can either be installed via pip install opt_einsum or from conda conda install opt_einsum -c conda-forge. See the installation documentation for further methods.

Citation

If this code has benefited your research, please support us by citing:

Daniel G. A. Smith and Johnnie Gray, opt_einsum - A Python package for optimizing contraction order for einsum-like expressions. Journal of Open Source Software, 2018, 3(26), 753

DOI: https://doi.org/10.21105/joss.00753

Contributing

All contributions, bug reports, bug fixes, documentation improvements, enhancements, and ideas are welcome.

A detailed overview on how to contribute can be found in the contributing guide.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].