Shortcuts

DimConstraints

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

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

add(expr)[source][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][source]

Add an equality constraint

forced_specializations()[source][source]

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

Return type

Dict[str, Expr]

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

Format a message for constraint violation erros

Return type

str

rewrite_with_congruences(s, expr)[source][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][source]

Solve the system of constraint equations to find simplified constraints

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources