jax-ml/jax · error · InconclusiveDimensionOperation
Symbolic dimension comparison {cmp_str()} is inconclusive.{d
Error message
Symbolic dimension comparison {cmp_str()} is inconclusive.{describe_scope} What it means
JAX needed to decide whether one symbolic dimension is <, <=, ==, >= or > another, but the known constraints do not imply the answer either way. Symbolic comparisons are only resolved when provable, so an unconstrained comparison raises InconclusiveDimensionOperation.
Source
Thrown at jax/_src/export/shape_poly.py:1199
if isinstance(e1, _DimExpr):
scope = e1.scope
if isinstance(e2, _DimExpr):
scope._check_same_scope(e2, f"when comparing {cmp_str()}")
elif isinstance(e2, _DimExpr):
scope = e2.scope
else:
return int(e1) >= int(e2)
lb, ub = _bounds_decision(e1 - e2, BoundsPrecision.FOR_GEQ0_OR_LT0)
if lb >= 0:
return True
if ub < 0:
return False
if scope._explicit_constraints:
describe_scope = f"\nUsing symbolic scope {scope}"
else:
describe_scope = ""
raise InconclusiveDimensionOperation(
f"Symbolic dimension comparison {cmp_str()} is inconclusive.{describe_scope}")
core.pytype_aval_mappings[_DimExpr] = _DimExpr._get_aval
dtypes.register_weak_scalar_type(_DimExpr)
def _convertible_to_int(p: Any) -> TypeGuard[SupportsIndex]:
try:
op.index(p)
return True
except:
return False
def _ensure_poly(p: DimSize,
operation_name: str,
scope: SymbolicScope) -> _DimExpr:
if isinstance(p, _DimExpr):
scope._check_same_scope(p, when=f"for operation {operation_name}")
return pView on GitHub (pinned to 1e1c6a8fc0)
Solutions
- Add explicit constraints to the SymbolicScope (e.g. 'n <= m', 'n >= 1') so the comparison becomes provable
- Restructure code to avoid comparing symbolic dims (use jnp.where / lax.select on values, not shapes)
- Make the compared dimension concrete by removing it from polymorphic_shapes
Example fix
# before
out = jnp.where(x.shape[0] >= 8, f(x), g(x)) # symbolic n >= 8 inconclusive
# after
constraints = ('n >= 8',)
exp = jax.export.export(shapes('n,'), constraints=constraints)(fn) Defensive patterns
Strategy: try-catch
Validate before calling
# predeclare all needed orderings as constraints
constraints = tuple(f'{a} <= {b}' for a, b in known_orderings) + tuple(f'{v} >= 1' for v in vars) Try / catch
from jax._src.export import shape_poly
try:
branch = x.shape[0] >= 8
except shape_poly.InconclusiveDimensionOperation:
branch = default_branch() # restructure or add constraint Prevention
- Avoid host-side branching on symbolic shape comparisons
- Declare order/bounds as explicit constraints up front
When it happens
Trigger: Comparisons like n < m for independent symbolic vars during export; assertions on shapes (x.shape[0] == y.shape[0] with unrelated vars); broadcasting decisions that need ordering of symbolic dims.
Common situations: Branching on shape relationships inside traced code (if x.shape[0] > 1), padding/valid-checking logic, or eager vs. polymorphic export where a comparison that is constant for concrete shapes becomes symbolic.
Related errors
- Encountered dimension variable '{self.var}' that is not appe
- Cannot divide {self} by {divisor}.
- __pow__ modulo not implemented
- Symbolic dimension cannot be raised to non-integer powers: '
- Symbolic dimension cannot be raised to negative powers: '{se
AI-assisted analysis of jax-ml/jax@1e1c6a8fc0 (2026-08-27).
Data as JSON: /api/errors/d856370633ceab17.
Report an issue: GitHub.