Template Function tvm::ffi::StructuralWalk

Template Function tvm::ffi::StructuralWalk#

Function Documentation#

template<WalkOrder order, typename ...Callbacks>
Optional<VisitInterrupt> tvm::ffi::StructuralWalk(AnyView root, Callbacks&&... callbacks)#

Throwing error over tvm::ffi::StructuralWalkExpected.

See tvm::ffi::StructuralWalkExpected for callback semantics and traversal behavior.

Note

Return type of each callback should be Expected<WalkResult>.

Template Parameters:
  • order – Whether to invoke the callback before or after visiting children.

  • Callbacks – Callback types.

Parameters:
  • root – The root value to visit.

  • callbacks – Callbacks invoked for matching nodes. Each callback may take either (value) or (value, def_region_kind) and should return Expected<WalkResult>.

Throws:

Error – if traversal or a callback returned an error.

Returns:

std::nullopt if traversal completed, or the interrupt returned by a callback.