tvm_ffi.VisitInterrupt#
- class tvm_ffi.VisitInterrupt(value=None)#
Bases:
ObjectPayload-carrying signal that stops a structural visit.
This object can be returned from structural walk callbacks and structural visit hooks to halt traversal early. The optional payload is preserved in
valueand returned to the caller.Examples
Use
VisitInterruptto stop a structural walk when a target node is found:import tvm_ffi def on_node(node): if is_target(node): return tvm_ffi.VisitInterrupt(node) return None result = tvm_ffi.structural_walk(root, (object, on_node), order="pre") if result is not None: found = result.value
See also
tvm_ffi.structural_walk()Structural walk API whose callbacks may return
VisitInterrupt.
- Parameters:
value (Any)
- property value#