Template Function tvm::tirx::StructuralMutateWithConstraintContext#
Function Documentation#
-
template<typename ...Callbacks>
ffi::Any tvm::tirx::StructuralMutateWithConstraintContext(ffi::Any root, Callbacks&&... callbacks)# Mutate with (value, StructuralMutatorWithConstraintContextObj* [, InplaceMode]). The first matching callback owns descent, exactly as in ffi::StructuralMutate. Return a replacement/Unchanged or Expected thereof. Delegate to mutator->DefaultMutateExpected(value, mode) for constraint-aware descent; recurse with MutateExpected(child, mode). Both use the same context and remap.
auto result = StructuralMutateWithConstraintContext(stmt, [](const IfObj* node, StructuralMutatorWithConstraintContextObj* mutator, ffi::InplaceMode mode) -> ffi::Expected<ffi::Any> { auto mapped = mutator->DefaultMutateExpected(node, mode); if (mapped.is_err()) return ffi::Unexpected(mapped.error()); return std::move(mapped).value().ValueOrUnchanged(ffi::Any(node)); });