FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

BUG: np.einsum() fails with a 0-dimensional out argument and optimize='optimal' by krivenko · Pull Request #31354 · numpy/numpy · GitHub

/ numpy Public

BUG: np.einsum() fails with a 0-dimensional out argument and optimize='optimal' - #31354

Merged
seberg merged 3 commits into
numpy:mainfrom
krivenko:einsum-0d-out-optimize
Apr 28, 2026
Merged

BUG: np.einsum() fails with a 0-dimensional out argument and optimize='optimal'#31354
seberg merged 3 commits into
numpy:mainfrom
krivenko:einsum-0d-out-optimize

Conversation

Copy link
Copy Markdown
Contributor

PR summary

This PR fixes #31350.

It replaces the expression out[:] found in bmm_einsum() with the more universal out[...], which is also valid for a 0-dimensional out.

TestEinsum.test_einsum_misc() in numpy/_core/tests/test_einsum.py has been extended to cover #31350.

First time committer introduction

I am a researcher who uses NumPy in a multitude of scientific computing projects, mostly simulation codes for computational condensed matter theory. I discovered the issue #31350 while working on one of such (private) projects.

AI Disclosure

No AI has been used in preparation of this PR.

seberg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks, small nit, but I think it is also good as is.

seberg added 00 - Bug 09 - Backport-Candidate PRs tagged should be backported labels Apr 28, 2026
Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net>
krivenko force-pushed the einsum-0d-out-optimize branch from d108479 to 5ea7e7c Compare April 28, 2026 14:15

Copy link
Copy Markdown
Contributor Author

@seberg There was a missing : in the change you suggested, so I had to amend that commit...

Comment thread numpy/_core/tests/test_einsum.py Outdated
Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net>

seberg commented Apr 28, 2026

Copy link
Copy Markdown
Member

Thanks @krivenko, nice little fix!

seberg merged commit 425f631 into numpy:main Apr 28, 2026
85 of 86 checks passed
charris removed the 09 - Backport-Candidate PRs tagged should be backported label Apr 28, 2026
krivenko deleted the einsum-0d-out-optimize branch April 28, 2026 19:09
charris pushed a commit that referenced this pull request Apr 28, 2026
…='optimal' (#31354)

It replaces the expression out[:] found in bmm_einsum() with the more universal out[...], which is also valid for a 0-dimensional out.
TestEinsum.test_einsum_misc() in numpy/_core/tests/test_einsum.py has been extended.

Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net>
charris added a commit that referenced this pull request Apr 28, 2026
BUG: np.einsum() fails with a 0-dimensional out argument and optimize='optimal' (#31354)
MaanasArora pushed a commit to MaanasArora/numpy that referenced this pull request May 7, 2026
…='optimal' (numpy#31354)

It replaces the expression out[:] found in bmm_einsum() with the more universal out[...], which is also valid for a 0-dimensional out.
TestEinsum.test_einsum_misc() in numpy/_core/tests/test_einsum.py has been extended.

Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: np.einsum() fails with a 0-dimensional out argument and optimize='optimal'

3 participants


Back | FazBrowse Home | New Git URL