Skip to content

Commit

Permalink
Better error reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
fferflo committed Mar 9, 2024
1 parent e701eb0 commit 80673c7
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions einx/op/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,24 @@ def after_stage2(exprs1, exprs2):
)[: len(op[0]) + 1]
exprs_in, expr_out = exprs[: len(op[0])], exprs[len(op[0])]

if update:
# Check that all axes in first input expression also appear in output expression
axes_in = {
axis.name
for axis in exprs_in[0].all()
if isinstance(axis, einx.expr.stage3.Axis)
}
axes_out = {
axis.name
for axis in expr_out.all()
if isinstance(axis, einx.expr.stage3.Axis)
}
if not axes_in.issubset(axes_out):
raise ValueError(
f"Output expression does not contain all axes from first input expression: "
f"{axes_in - axes_out}"
)

return exprs_in, expr_out


Expand Down

0 comments on commit 80673c7

Please sign in to comment.