Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion numpy/_core/einsumfunc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1223,7 +1223,7 @@ def bmm_einsum(eq, a, b, out=None, **kwargs):
if (out is not None) and (not matmul_out_compatible):
# handle case where out is specified, but we also needed
# to reshape / transpose ``ab`` after the matmul
out[:] = ab
out[...] = ab
ab = out
elif output_order is not None:
ab = asanyarray(ab, order=output_order)
Expand Down
8 changes: 8 additions & 0 deletions numpy/_core/tests/test_einsum.py
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,14 @@ def test_einsum_misc(self):
# see issue gh-15776 and issue gh-15256
assert_equal(np.einsum('i,j', [1], [2], out=None), [[2]])

# Issue gh-31350, a zero-dimensional out must not cause an error
Comment thread
krivenko marked this conversation as resolved.
# with optimize='optimal'
a = np.ones(7)
out = np.array(0)
np.einsum('i,i->', a, a, out=out, optimize='optimal')
assert_equal(out, 7)


Comment thread
seberg marked this conversation as resolved.
Outdated
def test_object_loop(self):

class Mult:
Expand Down
Loading