8000 Consider linking einsum and move axis · Issue #11658 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

Consider linking einsum and move axis #11658

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
eric-wieser opened this issue Aug 1, 2018 · 0 comments
Open

Consider linking einsum and move axis #11658

eric-wieser opened this issue Aug 1, 2018 · 0 comments

Comments

@eric-wieser
Copy link
Member

Brought up by this comment, it turns out that einsum actually is another name for moveaxis, and is 10 times faster

a = np.zeros((10, 20, 30))

%timeit np.einsum('abc->cba', a)
2.24 µs ± 375 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)

%timeit np.einsum(a, [0, 1, 2], [2, 1, 0])
2.65 µs ± 132 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)

%timeit np.moveaxis(a, [0, 1, 2], [2, 1, 0])
22.1 µs ± 3.47 µs per loop (mean ± std. dev. of 7 runs, 100000 loops each)

Perhaps we should take advantage of this, especally since it would counteract the performance cost of #9475

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant
0