Skip to content

Reject ambiguous axis inference with zero-sized factors - #444

Open
Robertboy18 wants to merge 1 commit into
arogozhnikov:mainfrom
Robertboy18:robert/zero-factor-shape-error
Open

Reject ambiguous axis inference with zero-sized factors#444
Robertboy18 wants to merge 1 commit into
arogozhnikov:mainfrom
Robertboy18:robert/zero-factor-shape-error

Conversation

@Robertboy18

Copy link
Copy Markdown

I noticed that inferring an axis in a composite dimension with a known zero-sized factor currently leaks a raw ZeroDivisionError, for example rearrange(x, "(a b) -> a b", a=0).

Since 0 * b = 0 does not determine b, this raises EinopsError before the modulo/division instead. I added tests for invalid inputs and valid empty-tensor cases.

I was looking at the same zero-product condition while working on TorchLean, and I can share the formalization too if useful :)

Copilot AI lite review requested due to automatic review settings September 8, 2026 02:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants