Skip to content

Commit

Permalink
BUG: Raise error in np.einsum_path when multiple output subscripts ar…
Browse files Browse the repository at this point in the history
…e specified
  • Loading branch information
lgeiger committed Nov 22, 2023
1 parent 1166ef8 commit a891dc9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions numpy/_core/einsumfunc.py
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,9 @@ def _parse_einsum_input(operands):

# Make sure output subscripts are in the input
for char in output_subscript:
if output_subscript.count(char) != 1:
raise ValueError("Output character %s appeared more than once in "
"the output." % char)
if char not in input_subscripts:
raise ValueError("Output character %s did not appear in the input"
% char)
Expand Down

0 comments on commit a891dc9

Please sign in to comment.