Poplar and PopLibs
poplar::program::If Class Reference

A program that runs one of two programs depending on the value of a scalar tensor. More...

#include <Program.hpp>

Inheritance diagram for poplar::program::If:
poplar::program::Program

Public Member Functions

 If (Tensor predicate, const Program &trueBody, const Program &falseBody, const DebugContext &debugContext={})
 A program that executes trueBody or falseBody depending on the value of predicate. More...
 

Detailed Description

A program that runs one of two programs depending on the value of a scalar tensor.

Constructor & Destructor Documentation

◆ If()

poplar::program::If::If ( Tensor  predicate,
const Program trueBody,
const Program falseBody,
const DebugContext debugContext = {} 
)

A program that executes trueBody or falseBody depending on the value of predicate.

You can pass an empty Sequence to either trueBody or falseBody if you don't want that branch to do anything. Any non-zero value of the predicate is treated as true.

Parameters
predicateThe scalar tensor (of type BOOL, UNSIGNED_INT, INT, SHORT or UNSIGNED_SHORT) that determines which branch to execute.
trueBodyThis program is run if the predicate is true.
falseBodyThis program is run if the predicate is false.
debugContextOptional DebugId and program name.

The documentation for this class was generated from the following file: