New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

einop

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

einop

0.0.1
PyPI
Maintainers
1

Einop

One op to rule them all

Einop is a very thin wrapper around einops that combines rearrange, reduce, and repeat into a single einop function. This library is a port of arogozhnikov/einops#91 by Miles Cranmer into a separate library, if at some point that PR is merged use einop directly from einops instead.

Installation

pip install einop

Usage

import numpy as np
from einop import einop

x = np.random.uniform(size=(10, 20))
y = einop(x, "height width -> batch width height", batch=32)

assert y.shape == (32, 20, 10)
Rearrange
einop(x, 'i j k -> k i j').shape
>>> (3, 100, 5)
Reduction
import numpy as np
from einops import einop

x = np.random.randn(100, 5, 3)

einop(x, 'i j k -> i j', reduction='sum').shape
>>> (100, 5)
Repeat
einop(x, 'i j k -> i j k l', l=10).shape
(100, 5, 3, 10)

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts