Skip to main content

Drop-in replacement for torch/numpy einsum, with descriptive variable names in equations

Project description

Fancy Einsum

This is a simple wrapper around np.einsum and torch.einsum that allows the use of self-documenting variable names instead of just single letters in the equations. Inspired by the syntax in einops.

For example, instead of writing:

import torch
torch.einsum('bct,bcs->bcts', a, b)

or

import numpy as np
np.einsum('bct,bcs->bcts', a, b)

With this library you can write:

from fancy_einsum import einsum
einsum('batch channels time1, batch channels time2 -> batch channels time1 time2', a, b)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fancy_einsum-0.0.3.tar.gz (4.9 kB view hashes)

Uploaded Source

Built Distribution

fancy_einsum-0.0.3-py3-none-any.whl (6.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page