Rate this Page

DimConstraints#

class torch.fx.experimental.symbolic_shapes.DimConstraints(symbol_to_source, var_to_val, marked_dynamic, source_name_to_debug_name)[source]#

Custom solver for a system of constraints on symbolic dimensions. Solutions are “static” values or simplified “dynamic” constraints.

add(expr)[source]#

Add an expression to the set of constraints.

Return whether the expression is a trivial constraint (i.e., an obvious tautology).

Return type

bool

add_equality(source, expr)[source]#

Add an equality constraint

forced_specializations()[source]#

Returns a dictionary of the names of symbols to their specialized value

Return type

dict[str, sympy.core.expr.Expr]

prettify_results(original_signature, dynamic_shapes, constraint_violation_error, forced_specializations)[source]#

Format a message for constraint violation erros

Return type

str

rewrite_with_congruences(s, expr)[source]#

Eliminate expressions of the form b // d and b % d while adding congruences of the form b % d == k. This leaves rational operators (in particular of the form b / d) that our inequality solver can handle. We solve the added congruences separately (using our congruence solver, see below).

Return type

_SympyT

solve()[source]#

Solve the system of constraint equations to find simplified constraints