Poplar and PopLibs
|
A program that executes a program repeatedly while a condition is true. More...
#include <Program.hpp>
Public Member Functions | |
RepeatWhileTrue (const Program &cond, Tensor predicate, const Program &body, const DebugContext &debugContext={}) | |
Construct a repeat-while-true program. More... | |
A program that executes a program repeatedly while a condition is true.
The program starts by executing the condition program, cond
, which should set the value of predicate
. If predicate
is false, then the loop exits. If predicate
is true then the body
program is executed, and then it loops to execute cond
program again.
This is like a C while statement.
poplar::program::RepeatWhileTrue::RepeatWhileTrue | ( | const Program & | cond, |
Tensor | predicate, | ||
const Program & | body, | ||
const DebugContext & | debugContext = {} |
||
) |
Construct a repeat-while-true program.
cond | The program executed before predicate is evaluated. The normal use case is that this will set the value of predicate . |
predicate | The scalar tensor (of type BOOL, UNSIGNED_INT, INT, SHORT or UNSIGNED_SHORT) that determines whether to execute body . Any non-zero value of the predicate is treated as true. |
body | The body to execute when predicate is true. |
debugContext | Optional DebugId and program name. |