Shortcuts

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

prettify_results(original_signature, constraint_violation_error=None, forced_specializations=None)[source]

Format a message for constraint violation erros

remove_redundant_dynamic_results()[source]

Remove constraints of the form 2 <= dynamic_dim(…) as 2 is the default lower bound.

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).

solve(disable_congruences=True, disable_equivalences=True)[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