Rate this Page

torch.fx.experimental.symbolic_shapes.canonicalize_bool_expr#

torch.fx.experimental.symbolic_shapes.canonicalize_bool_expr(expr)[source]#

Canonicalize supported boolean expressions recursively. Ge/Gt relations are rewritten as Le/Lt, and relations with arithmetic operands are normalized by subtraction. Relations with boolean operands are canonicalized structurally without arithmetic. And / Or / Not expressions are first converted to CNF. nb. sympy.Rel.canonical is not good enough sympy/sympy#25924

Parameters:

expr (_T) – Expression to canonicalize

Return type:

_T