torch.fx.experimental.symbolic_shapes.canonicalize_bool_expr¶
- torch.fx.experimental.symbolic_shapes.canonicalize_bool_expr(expr)[source]¶
Canonicalize a boolean expression by transforming it into a lt / le inequality and moving all the non-constant terms to the rhs. We canonicalize And / Ors / Not via cnf and then canonicalize their subexpr recursively nb. sympy.Rel.canonical is not good enough https://github.com/sympy/sympy/issues/25924
- Parameters
expr (sympy.Expr) – Expression to canonicalize
- Return type
Boolean