Skip to content

Commit

Permalink
Merge pull request #10397 from charris/backport-10354
Browse files Browse the repository at this point in the history
BUG: fix error message not formatted in einsum
  • Loading branch information
charris committed Jan 14, 2018
2 parents 0147728 + 34d2e7e commit 27ec6eb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions numpy/core/einsumfunc.py
Original file line number Diff line number Diff line change
Expand Up @@ -701,14 +701,15 @@ def einsum_path(*operands, **kwargs):
sh = operands[tnum].shape
if len(sh) != len(term):
raise ValueError("Einstein sum subscript %s does not contain the "
"correct number of indices for operand %d.",
input_subscripts[tnum], tnum)
"correct number of indices for operand %d."
% (input_subscripts[tnum], tnum))
for cnum, char in enumerate(term):
dim = sh[cnum]
if char in dimension_dict.keys():
if dimension_dict[char] != dim:
raise ValueError("Size of label '%s' for operand %d does "
"not match previous terms.", char, tnum)
"not match previous terms."
% (char, tnum))
else:
dimension_dict[char] = dim

Expand Down

0 comments on commit 27ec6eb

Please sign in to comment.