tvm_ffi.VisitInterrupt#
- class tvm_ffi.VisitInterrupt(value=None)[source]#
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)) 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, default:None)
- __init__(value=None)[source]#
Create an interrupt with an optional payload.
- Parameters:
value (
Any, default:None) – Payload returned to the caller when traversal stops.- Return type:
None
Methods
__ffi_init__(*args, **kwargs)__init__([value])Create an interrupt with an optional payload.
__init_handle_by_constructor__(fconstructor, ...)Defined in
Objectas method__init_handle_by_constructor__().__move_handle_from__(other)Defined in
Objectas method__move_handle_from__()._move()is_(other)Defined in
Objectas methodis_().same_as(other)Attributes
- property value#