Execute the steps for which the condition is true. Each condition is a tuple (condition_blob_or_net, nets_or_steps). Note: 1. Multi steps can be executed if their conditions are true. 2. The conditions_blob_or_net (if it is Net) of all steps will be executed once.
(name, *conditions)
| 493 | |
| 494 | |
| 495 | def Switch(name, *conditions): |
| 496 | """ |
| 497 | Execute the steps for which the condition is true. |
| 498 | Each condition is a tuple (condition_blob_or_net, nets_or_steps). |
| 499 | Note: |
| 500 | 1. Multi steps can be executed if their conditions are true. |
| 501 | 2. The conditions_blob_or_net (if it is Net) of all steps will be |
| 502 | executed once. |
| 503 | |
| 504 | Examples: |
| 505 | - Switch('name', (cond_1, net_1), (cond_2, net_2), ..., (cond_n, net_n)) |
| 506 | - Switch('name', [(cond_1, net1), (cond_2, net_2), ..., (cond_n, net_n)]) |
| 507 | - Switch('name', (cond_1, net_1)) |
| 508 | """ |
| 509 | conditions = _MakeList(conditions) |
| 510 | return core.scoped_execution_step( |
| 511 | _get_next_step_name('Switch', name), |
| 512 | [_RunOnceIf(name + '/Switch', cond, step) for cond, step in conditions]) |
| 513 | |
| 514 | |
| 515 | def SwitchNot(name, *conditions): |
nothing calls this directly
no test coverage detected
searching dependent graphs…