You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
to_executorch() fails on !=, & and | between symbolic sizes #25910
torch.export accepts a comparison !=, or a & / | between symbolic booleans, on dynamic sizes (a common shape for torch.cond predicates), but to_executorch() then fails with invalid target for call_function. _PYTHON_SYM_OPS_TO_EXECUTORCH_SYM_OPS in exir/passes/executorch_prim_ops_registry.py maps operator.eq, gt, lt, ge, le and torch.sym_not, but not operator.ne, operator.and_ or operator.or_, and kernels/prim_ops/register_prim_ops.cpp has no matching kernels. I found this while comparing the runtime with eager on small programs with dynamic shapes.
executorch.exir.error.InternalError: Failed with error: invalid target for call_function <built-in function ne>
(t.shape[0] > 3) & (t.shape[0] < 10) fails the same way with <built-in function and_>, and | with <built-in function or_>. The same program with == lowers and runs.
This is the same gap as #25767 (operator.pow) and #25772 (math.floor), for different operators. I have a fix that adds executorch_prim::ne.Scalar, sym_and.Scalar and sym_or.Scalar on the model of eq and sym_not, with tests, and will open a PR linked to this issue.
Versions
ExecuTorch built from main at 035df43, PyTorch 2.15.0+cpu, Python 3.12.3, Ubuntu 24.04 on WSL2, x86_64.
This issue was written with the help of Claude Code (Anthropic); I verified the reproduction.
Activity