tvm_tirx.tirx.structural.StructuralMutatorWithConstraintContext#

class tvm_tirx.tirx.structural.StructuralMutatorWithConstraintContext#

Bases: StructuralMutator

Mutates values using their structural mutation behavior while maintaining the constraint context relevant to each callback.

Constraints use the resulting expressions and bindings.

Construct an instance for default transformation, or use the mutator supplied to a structural_mutate_with_constraint_context() callback to control recursion. Both mutate and default_mutate preserve their input values, copying nodes whose children change.

Variables:

constraints (tvm_tirx.sym.ConstraintContext) – Effective symbolic facts active at the current value. Read them in ancestor-first order by iterating this context. Do not append during traversal.

default_mutate(value)#

Transform a value’s children with the applicable symbolic facts.

In a traversal callback, use this method to transform all children without calling the callback again on value itself. Child callbacks still receive this mutator and its active facts. Intermediate sequence and lazy-call argument arrays receive no callback.

Parameters:

value (Any) – Value whose children should be transformed. It is preserved even when the result changes.

Returns:

result (Any) – The original value if no child changes, otherwise a transformed copy with the resulting children.

property constraints#