If condition_blob_or_net returns false, executes true_nets_or_steps, otherwise executes false_nets_or_steps
(name, condition_blob_or_net,
true_nets_or_steps, false_nets_or_steps=None)
| 552 | |
| 553 | |
| 554 | def IfNot(name, condition_blob_or_net, |
| 555 | true_nets_or_steps, false_nets_or_steps=None): |
| 556 | """ |
| 557 | If condition_blob_or_net returns false, executes true_nets_or_steps, |
| 558 | otherwise executes false_nets_or_steps |
| 559 | """ |
| 560 | if not false_nets_or_steps: |
| 561 | return _RunOnceIfNot(name + '/IfNot', |
| 562 | condition_blob_or_net, true_nets_or_steps) |
| 563 | |
| 564 | if isinstance(condition_blob_or_net, core.Net): |
| 565 | condition_blob = GetConditionBlobFromNet(condition_blob_or_net) |
| 566 | else: |
| 567 | condition_blob = condition_blob_or_net |
| 568 | |
| 569 | return Do( |
| 570 | name + '/IfNot', |
| 571 | _RunOnceIfNot(name + '/IfNot-true', |
| 572 | condition_blob_or_net, true_nets_or_steps), |
| 573 | _RunOnceIf(name + '/IfNot-false', condition_blob, false_nets_or_steps) |
| 574 | ) |
nothing calls this directly
no test coverage detected
searching dependent graphs…