Switch¶
Switch expression for conditional control.
This node is used as follows: a value is wired into test_value, and then that value is compared with the values set in the match 1 through math 10 parameters, in 1-10 order. If a match is found, the corresponding branch is executed and its value returned and remaining conditions are not evaluated. If no conditions match, then the branch wired into else_branch is executed and its value (the output of its execution) is returned through the result port, which can be wired into a downstream node for processing. If nothing was wired into the condition port that was selected for execution, then the result outputs None. The Switch and ConditionSwitch nodes differ in their use in that the Switch node is used to control the execution of an upstream branch and return its result downstream, whereas the ConditionSwitch is used to control the execution of downstream nodes (usually by wiring it into the Passthrough node to "turn off" execution at a given point in the pipeline).
Version 1.0.0
Ports/Properties¶
test_value¶
Value to test.
condition1¶
Test value for branch 1.
branch1¶
Branch 1.
condition2¶
Test value for branch 2.
branch2¶
Branch 2.
condition3¶
Test value for branch 3.
branch3¶
Branch 3.
condition4¶
Test value for branch 4.
branch4¶
Branch 4.
condition5¶
Test value for branch 5.
branch5¶
Branch 5.
condition6¶
Test value for branch 6.
branch6¶
Branch 6.
condition7¶
Test value for branch 7.
branch7¶
Branch 7.
condition8¶
Test value for branch 8.
branch8¶
Branch 8.
condition9¶
Test value for branch 9.
branch9¶
Branch 9.
condition10¶
Test value for branch 10.
branch10¶
Branch 10.
else_branch¶
Else branch (no match).
result¶
Result of the branch that was evaluated.
emit_resets¶
Emit signal reset notifications when the condition changes. This can be used if the Switch node controls codepaths through which signals flow and where downstream nodes should reset themselves upon a change of the condition. However, note that, if the condition is systematically changing between training and test mode, this can lead to unexpected behavior: namely, if a Switch in a machine-learning pipeline is driven by an is_training flag, it will cause a reset when the training flag changes, which leads to a reset of trainable state downstream of the switch on the test set (unless the nodes are marked as do not reset model), which then causes retraining on the test set, which is likely a bug (that can give spuriously better results). For this reason, this flag is turned off by default, but it may be enabled if needed.
set_breakpoint¶
Set a breakpoint on this node. If this is enabled, your debugger (if one is attached) will trigger a breakpoint.
metadata¶
User-definable meta-data associated with the node. Usually reserved for technical purposes.