tvm_tirx.tirx.structural.structural_mutate_with_constraint_context

tvm_tirx.tirx.structural.structural_mutate_with_constraint_context#

tvm_tirx.tirx.structural.structural_mutate_with_constraint_context(root, callback)#

Mutate a value with a callback that owns recursive mutation.

The callback receives (value, mutator). It may call mutator.mutate for selected children or mutator.default_mutate for the matched value’s default mutation. Its returned value is final and is not traversed again. mutator.constraints contains the active symbolic facts.

Parameters:
  • root (Any) – Root value to transform. A regular Python reference is preserved through copy-on-write.

  • callback (callable) – Called as callback(value, mutator) with a StructuralMutatorWithConstraintContext. Return the mutated owning value.

Returns:

result (Any) – The transformed root value.