Expr

#include <popops/Expr.hpp>

Expressions with elements of tensors.

Defines

POPLIBS_DEFINE_EXPR_UNARY_OP(Name, Op)
POPLIBS_DEFINE_EXPR_UNARY_OP_AND_SYMBOL(Name, Op, Sym)
POPLIBS_DEFINE_EXPR_BINARY_OP(Name, Op)
POPLIBS_DEFINE_EXPR_BINARY_OP_AND_SYMBOL(Name, Op, Sym)
POPLIBS_DEFINE_EXPR_TERNARY_OP(Name, Op)
namespace popops

Common functions, such as elementwise and reductions.

map

Map an expression across tensors.

Elementwise Options

  • enableGenerateCodelet (true, false) [=true]

    When true and the following conditions are met, poplar will generate a codelet to execute the map operation. Otherwise, it will sequence poplibs codelets to create the expression.

    • All of the inputs are of the same size

    • Inputs do not alias

    • Multiple operations are being performed

mapInPlace

Update the input tensors with the result of map().

mapWithOutput

Write the result of map() to the given output tensor.

checkTypes

Check that the host compile-time type constType is compatible with the run-time IPU type elementType.

param elementType

The run-time IPU type.

param constant

Unused.

tparam constType

The host compile-time type.

throws std::runtime_error

If the types are not compatible.

varianceToInvStdDev

Convert variance to inverse standard deviation.

Each element in the output tensor is the result of 1 / sqrt(variance_value + epsilon), where variance_value is the corresponding element in variance.

Warning

If variance_value + epsilon is zero then the result will be invalid and this operation could generate a divide-by-zero floating-point exception (if enabled).

param graph

The graph to update.

param variance

A tensor of variance values.

param epsilon

A (typically small) scalar to add to the variance values, to avoid numerical issues (for example, divide by zero).

param prog

The sequence of programs to append this conversion operation to.

param debugContext

Optional debug information.

return

A tensor where each element is the inverse standard deviation.

invStdDevToVariance

Convert inverse standard deviation to variance.

Each element in the output tensor is the result of 1 / (invStdDev_value + epsilon)^2, where invStdDev_value is the corresponding element in invStdDev.

Warning

If invStdDev_value + epsilon is zero then the result will be invalid and this operation could generate a divide-by-zero floating-point exception (if enabled).

param graph

The graph to update.

param invStdDev

A tensor of inverse standard deviation values.

param epsilon

A (typically small) scalar to add to the variance values, to avoid numerical issues (for example, divide by zero).

param prog

The sequence of programs to append this conversion operation to.

param debugContext

Optional debug information.

param options

A list of flags to pass to the expression evaluator.

return

A tensor where each element is the variance.

add

Add each element in A to the corresponding element in B.

param graph

The graph to update.

param A

A tensor of elements.

param B

A tensor of elements.

param prog

The sequence to extend with the execution of the expression evaluation.

param debugContext

Optional debug information

param options

Element-wise options. See map().

return

A tensor where each element is the result of a + b, where a and b are the corresponding elements of A and B tensors respectively.

addInPlace

Update the tensor A with the result of add().

See add() for parameter descriptions.

addWithOutput

Write the result of add() to the given output tensor, out.

See add() for the remaining parameter descriptions.

param out

The tensor to write the results to.

sub

Subtract the elements of B from A and return the result in a new tensor.

param graph

The graph to update.

param A

The tensor of elements which will be subtracted from.

param B

The tensor of elements to subtract from A.

param prog

The sequence to extend with the execution of the expression evaluation.

param debugContext

Optional debug information.

param options

Element-wise options. See map().

return

A tensor where each element is equal to a - b, where a and b are the corresponding elements of A and B tensors respectively.

subInPlace

Update the tensor A with the result of sub().

See sub() for parameter descriptions.

subWithOutput

Write the result of sub() to the given output tensor, out.

See sub() for the remaining parameter descriptions.

param out

The tensor to write the results to.

mul

Multiply each element in A by the corresponding element in B.

param graph

The graph to update.

param A

A tensor of elements.

param B

A tensor of elements.

param prog

The sequence to extend with the execution of the expression evaluation.

param debugContext

Optional debug information.

param options

Element-wise options. See map().

return

A tensor where each element is the result of a * b, where a and b are the corresponding elements of A and B tensors respectively.

mulInPlace

Update the tensor A with the result of mul().

See mul() for parameter descriptions.

mulWithOutput

Write the result of mul() to the given output tensor, out.

See mul() for the remaining parameter descriptions.

param out

The tensor to write the results to.

div

Divide each element in A by the corresponding element in B.

param graph

The graph to update.

param A

The tensor of dividends.

param B

The tensor of divisors.

param prog

The sequence to extend with the execution of the expression evaluation.

param debugContext

Optional debug information

param options

Element-wise options. See map().

return

A tensor where each element is the result of a / b, where a and b are the corresponding elements of A and B tensors respectively.

divInPlace

Update the tensor A with the result of div().

See div() for parameter descriptions.

divWithOutput

Write the result of div() to the given output tensor, out.

See div() for the remaining parameter descriptions.

param out

The tensor to write the results to.

pow

Compute each element in A to the power of the corresponding element in B.

param graph

The graph to update.

param A

The tensor of bases.

param B

The tensor of exponents.

param prog

The sequence to extend with the execution of the expression evaluation.

param debugContext

Optional debug information.

param options

Element-wise options. See map().

return

A tensor where each element is equal to pow(a, b), where a and b are the corresponding elements of A and B tensors respectively.

powInPlace

Update the tensor A with the result of pow().

See pow() for parameter descriptions.

powWithOutput

Write the result of pow() to the given output tensor, out.

See pow() for the remaining parameter descriptions.

param out

The tensor to write the results to.

rem

Compute the remainder of each element in A divided by the corresponding element in B.

param graph

The graph to update.

param A

The tensor of dividends.

param B

The tensor of divisors.

param prog

The sequence to extend with the execution of the expression evaluation.

param debugContext

Optional debug information.

param options

Element-wise options. See map().

return

A tensor where each element is equal to a % b, where a and b are the corresponding elements of A and B tensors respectively.

remInPlace

Update the tensor A with the result of rem().

See rem() for parameter descriptions.

remWithOutput

Write the result of rem() to the given output tensor, out.

See rem() for the remaining parameter descriptions.

param out

The tensor to write the results to.

bitwiseAnd

Compute the bitwise AND of each element in A with the corresponding element in B.

param graph

The graph to update.

param A

A tensor of elements.

param B

A tensor of elements.

param prog

The sequence to extend with the execution of the expression evaluation.

param debugContext

Optional debug information

param options

Element-wise options. See map().

return

A tensor where each element is the result of a & b, where a and bare the corresponding elements of A and B tensors respectively.

bitwiseAndInPlace

Update the tensor A with the result of bitwiseAnd().

See bitwiseAnd() for parameter descriptions.

bitwiseAndWithOutput

Write the result of bitwiseAnd() to the given output tensor, out.

See bitwiseAnd() for the remaining parameter descriptions.

param out

The tensor to write the results to.

bitwiseOr

Compute the bitwise OR of each element in A with the corresponding element in B.

param graph

The graph to update.

param A

A tensor of elements.

param B

A tensor of elements.

param prog

The sequence to extend with the execution of the expression evaluation.

param debugContext

Optional debug information

param options

Element-wise options. See map().

return

A tensor where each element is the result of a | b, where a and b are the corresponding elements of A and B tensors respectively.

bitwiseOrInPlace

Update the tensor A with the result of bitwiseOr().

See bitwiseOr() for parameter descriptions.

bitwiseOrWithOutput

Write the result of bitwiseOr() to the given output tensor, out.

See bitwiseOr() for the remaining parameter descriptions.

param out

The tensor to write the results to.

bitwiseXor

Compute the bitwise XOR of each element in A with the corresponding element in B.

param graph

The graph to update.

param A

A tensor of elements.

param B

A tensor of elements.

param prog

The sequence to extend with the execution of the expression evaluation.

param debugContext

Optional debug information

param options

Element-wise options. See map().

return

A tensor where each element is the result of a ^ b, where a and b are the corresponding elements of A and B tensors respectively.

bitwiseXorInPlace

Update the tensor A with the result of bitwiseXor().

See bitwiseXnor() for parameter descriptions.

bitwiseXorWithOutput

Write the result of bitwiseXor() to the given output tensor, out.

See bitwiseXor() for the remaining parameter descriptions.

param out

The tensor to write the results to.

bitwiseXnor

Compute the bitwise XNOR of each element in A with the corresponding element in B.

param graph

The graph to update.

param A

A tensor of elements.

param B

A tensor of elements.

param prog

The sequence to extend with the execution of the expression evaluation.

param debugContext

Optional debug information

param options

Element-wise options. See map().

return

A tensor where each element is the result of !(a ^ b), where a and b are the corresponding elements of A and B tensors respectively.

bitwiseXnorInPlace

Update the tensor A with the result of bitwiseXnor().

See bitwiseXnor() for parameter descriptions.

bitwiseXnorWithOutput

Write the result of bitwiseXnor() to the given output tensor, out.

See bitwiseXnor() for the remaining parameter descriptions.

param out

The tensor to write the results to.

shiftLeft

Shift the elements of A left by the corresponding elements of B.

param graph

The graph to update.

param A

The tensor of elements which to left-shift.

param B

The tensor of elements that describe the amount to left-shift A by.

param prog

The sequence to extend with the execution of the expression evaluation.

param debugContext

Optional debug information.

param options

Element-wise options. See map().

return

A tensor where each element is equal to a << b, where a and b are the corresponding elements of A and B tensors respectively.

shiftLeftInPlace

Update the tensor A with the result of shiftLeft().

See shiftLeft() for parameter descriptions.

shiftLeftWithOutput

Write the result of shiftLeft() to the given output tensor, out.

See shiftLeft() for the remaining parameter descriptions.

param out

The tensor to write the results to.

shiftRight

Shift the elements of A right by the corresponding elements of B.

param graph

The graph to update.

param A

The tensor of elements which to right-shift.

param B

The tensor of elements that describe the amount to right-shift by. A.

param prog

The sequence to extend with the execution of the expression evaluation.

param debugContext

Optional debug information.

param options

Element-wise options. See map().

return

A tensor where each element is equal to a >> b (without sign extension), where a and b are the corresponding elements of A and B tensors respectively.

shiftRightInPlace

Update the tensor A with the result of shiftRight().

See shiftRight() for parameter descriptions.

shiftRightWithOutput

Write the result of shiftRight() to the given output tensor, out.

See shiftRight() for the remaining parameter descriptions.

param out

The tensor to write the results to.

shiftRightSignExtend

Shift the elements of A right with sign extension by the corresponding elements of B.

param graph

The graph to update.

param A

The tensor of elements which to right-shift.

param B

The tensor of elements that describe the amount to right-shift A by.

param prog

The sequence to extend with the execution of the expression evaluation.

param debugContext

Optional debug information.

param options

Element-wise options. See map().

return

A tensor where each element is equal to a >> b with sign extension, where a and b are the corresponding elements of A and B tensors respectively.

shiftRightSignExtendInPlace

Update the tensor A with the result of shiftRightSignExtend().

See shiftRightSignExtend() for parameter descriptions.

shiftRightSignExtendWithOutput

Write the result of shiftRightSignExtend() to the given output tensor, out.

See shiftRightSignExtend() for the remaining parameter descriptions.

param out

The tensor to write the results to.

logicalAnd

Compute the logical AND (&&) of each element in A with the corresponding element in B.

param graph

The graph to update.

param A

A tensor of elements.

param B

A tensor of elements.

param prog

The sequence to extend with the execution of the expression evaluation.

param debugContext

Optional debug information.

param options

Element-wise options. See map().

return

A tensor where each element is the result of a && b, where a and b are the corresponding elements of A and B tensors respectively.

logicalAndInPlace

Update the tensor A with the result of logicalAnd().

See logicalAnd() for parameter descriptions.

logicalAndWithOutput

Write the result of logicalAnd() to the given output tensor, out.

See logicalAnd() for the remaining parameter descriptions.

param out

The tensor to write the booleans to.

logicalOr

Compute the logical OR (||) of each element in A with the corresponding element in B.

param graph

The graph to update.

param A

A tensor of elements.

param B

A tensor of elements.

param prog

The sequence to extend with the execution of the expression evaluation.

param debugContext

Optional debug information.

param options

Element-wise options. See map().

return

A tensor where each element is the result of a || b, where a and b are the corresponding elements of A and B tensors respectively.

logicalOrInPlace

Update the tensor A with the result of logicalOr().

See logicalOr() for parameter descriptions.

logicalOrWithOutput

Write the result of logicalOr() to the given output tensor, out.

See logicalOr() for the remaining parameter descriptions.

param out

The tensor to write the booleans to.

eq

Check if each element in A is equal to the corresponding element in B.

param graph

The graph to update.

param A

A tensor of elements.

param B

A tensor of elements.

param prog

The sequence to extend with the execution of the expression evaluation.

param debugContext

Optional debug information

param options

Element-wise options. See map().

return

A tensor where each element is the result of a == b, where a and b are the corresponding elements of A and B tensors respectively.

eqInPlace

Update the tensor A with the result of eq().

See eq() for parameter descriptions.

eqWithOutput

Write the result of eq() to the given output tensor, out.

See eq() for the remaining parameter descriptions.

param out

The tensor to write the booleans to.

neq

Check if each element in A is not equal to the corresponding element in B.

param graph

The graph to update.

param A

A tensor of elements.

param B

A tensor of elements.

param prog

The sequence to extend with the execution of the expression evaluation.

param debugContext

Optional debug information.

param options

Element-wise options. See map().

return

A tensor where each element is the result of a != b, where a and b are the corresponding elements of A and B tensors respectively.

neqInPlace

Update the tensor A with the result of neq().

See neq() for parameter descriptions.

neqWithOutput

Write the result of neq() to the given output tensor, out.

See neq() for the remaining parameter descriptions.

param out

The tensor to write the booleans to.

gteq

Check if each element in A is greater than or equal to the corresponding element in B.

param graph

The graph to update.

param A

A tensor of elements.

param B

A tensor of elements.

param prog

The sequence to extend with the execution of the expression evaluation.

param debugContext

Optional debug information

param options

Element-wise options. See map().

return

A tensor where each element is the result of a >= b, where a and b are the corresponding elements of A and B tensors respectively.

gteqInPlace

Update the tensor A with the result of gteq().

See gteq() for parameter descriptions.

gteqWithOutput

Write the result of gteq() to the given output tensor, out.

See gteq() for the remaining parameter descriptions.

param out

The tensor to write the booleans to.

gt

Check if each element in A is greater than the corresponding element in B.

param graph

The graph to update.

param A

A tensor of elements.

param B

A tensor of elements.

param prog

The sequence to extend with the execution of the expression evaluation.

param debugContext

Optional debug information

param options

Element-wise options. See map().

return

A tensor where each element is the result of a > b, where a and b are the corresponding elements of A and B tensors respectively.

gtInPlace

Update the tensor A with the result of gt().

See gt() for parameter descriptions.

gtWithOutput

Write the result of gt() to the given output tensor, out.

See gt() for the remaining parameter descriptions.

param out

The tensor to write the booleans to.

lteq

Check if each element in A is less than or equal to the corresponding element in B.

param graph

The graph to update.

param A

A tensor of elements.

param B

A tensor of elements.

param prog

The sequence to extend with the execution of the expression evaluation.

param debugContext

Optional debug information.

param options

Element-wise options. See map().

return

A tensor where each element is the result of a <= b, where a and b are the corresponding elements of A and B tensors respectively.

lteqInPlace

Update the A with the result of lteq().

See lteq() for parameter descriptions.

lteqWithOutput

Write the result of lteq() to the given output tensor, out.

See lteq() for the remaining parameter descriptions.

param out

The tensor to write the booleans to.

lt

Check if each element in A is less than the corresponding element in B.

param graph

The graph to update.

param A

A tensor of elements.

param B

A tensor of elements.

param prog

The sequence to extend with the execution of the expression evaluation.

param debugContext

Optional debug information.

param options

Element-wise options. See map().

return

A tensor where each element is the result of a < b, where a and b are the corresponding elements of A and B tensors respectively.

ltInPlace

Update the A with the result of lt().

See lt() for parameter descriptions.

ltWithOutput

Write the result of lt() to the given output tensor, out.

See lt() for the remaining parameter descriptions.

param out

The tensor to write the boolean results to.

max

Compute the maximum of each element in A with the corresponding element in B.

param graph

The graph to update.

param A

A tensor of elements.

param B

A tensor of elements.

param prog

The sequence to extend with the execution of the expression evaluation.

param debugContext

Optional debug information.

param options

Element-wise options. See map().

return

A tensor where each element is the result of max(a, b), where a and b are the corresponding elements of A and B tensors respectively.

maxInPlace

Update the tensor A with the result of max().

See max() for parameter descriptions.

maxWithOutput

Write the result of max() to the given output tensor, out.

See max() for the remaining parameter descriptions.

param out

The tensor to write the maximums to.

min

Compute the minimum of each element in A with the corresponding element in B.

param graph

The graph to update.

param A

A tensor of elements.

param B

A tensor of elements.

param prog

The sequence to extend with the execution of the expression evaluation.

param debugContext

Optional debug information.

param options

Element-wise options. See map().

return

A tensor where each element is the result of min(a, b), where a and b are the corresponding elements of A and B tensors respectively.

minInPlace

Update the tensor A with the result of min().

See min() for parameter descriptions.

minWithOutput

Write the result of min() to the given output tensor, out.

See min() for the remaining parameter descriptions.

param out

The tensor to write the minimums to.

atan2

Compute the element-wise arctangent of A / B.

param graph

The graph to update.

param A

A tensor of elements.

param B

A tensor of elements.

param prog

The sequence to extend with the execution of the expression evaluation.

param debugContext

Optional debug information

param options

Element-wise options. See map().

return

A tensor where each element is the result of arctan(a / b); a and b are the corresponding elements of A and B tensors respectively.

atan2InPlace

Update the tensor A with the result of atan2().

See atan2() for parameter descriptions.

atan2WithOutput

Write the result of atan2() to the given output tensor, out.

See atan2() for the remaining parameter descriptions.

param out

The tensor to write the result to.

invStdDevToVarianceInPlace

Update the invStdDev tensor with the result of invStdDevToVariance().

See invStdDevToVariance() for parameter descriptions.

invStdDevToVarianceWithOutput

Write the result of invStdDevToVariance() to the given output tensor, out.

See invStdDevToVariance() for the remaining parameter descriptions.

param out

The tensor to write the variance to.

varianceToInvStdDevInPlace

Update the variance tensor with the result of varianceToInvStdDev().

See varianceToInvStdDev() for parameter descriptions.

varianceToInvStdDevWithOutput

Write the result of varianceToInvStdDev() to the given output tensor, out.

See varianceToInvStdDev() for the remaining parameter descriptions.

param out

The tensor to write inverse standard deviation to.

namespace expr

Functions

std::ostream &operator<<(std::ostream &os, const Expr &expr)
bool deepEquals(const Expr &a, const Expr &b)
inline ConstHalf operator""_half(long double x)
const PlaceHolder _1 (1)
const PlaceHolder _2 (2)
const PlaceHolder _3 (3)
const PlaceHolder _4 (4)
const PlaceHolder _5 (5)
const PlaceHolder _6 (6)
const PlaceHolder _7 (7)
const PlaceHolder _8 (8)
const PlaceHolder _9 (9)
const PlaceHolder _10 (10)
const PlaceHolder _11 (11)
const PlaceHolder _12 (12)
const PlaceHolder _13 (13)
const PlaceHolder _14 (14)
const PlaceHolder _15 (15)
const PlaceHolder _16 (16)
const PlaceHolder _17 (17)
const PlaceHolder _18 (18)
const PlaceHolder _19 (19)
const PlaceHolder _20 (20)
inline BitwiseNot operator~(const Expr &a)
inline Not operator!(const Expr &a)
inline Neg operator-(const Expr &a)
template<typename T> inline std::enable_if<!std::is_base_of< Expr, T >::value &&poplar::TypeTraits::isSimpleType< T >), Add >::type operator+ (const T &a, const Expr &b)
template<typename T> inline std::enable_if<!std::is_base_of< Expr, T >::value &&poplar::TypeTraits::isSimpleType< T >), Add >::type operator+ (const Expr &a, const T &b)
inline Add operator+(const Expr &a, const Expr &b)
template<typename T> inline std::enable_if<!std::is_base_of< Expr, T >::value &&poplar::TypeTraits::isSimpleType< T >), BitwiseAnd >::type operator& (const T &a, const Expr &b)
template<typename T> inline std::enable_if<!std::is_base_of< Expr, T >::value &&poplar::TypeTraits::isSimpleType< T >), BitwiseAnd >::type operator& (const Expr &a, const T &b)
inline BitwiseAnd operator&(const Expr &a, const Expr &b)
template<typename T> inline std::enable_if<!std::is_base_of< Expr, T >::value &&poplar::TypeTraits::isSimpleType< T >), BitwiseOr >::type operator| (const T &a, const Expr &b)
template<typename T> inline std::enable_if<!std::is_base_of< Expr, T >::value &&poplar::TypeTraits::isSimpleType< T >), BitwiseOr >::type operator| (const Expr &a, const T &b)
inline BitwiseOr operator|(const Expr &a, const Expr &b)
template<typename T> inline std::enable_if<!std::is_base_of< Expr, T >::value &&poplar::TypeTraits::isSimpleType< T >), BitwiseXor >::type operator^ (const T &a, const Expr &b)
template<typename T> inline std::enable_if<!std::is_base_of< Expr, T >::value &&poplar::TypeTraits::isSimpleType< T >), BitwiseXor >::type operator^ (const Expr &a, const T &b)
inline BitwiseXor operator^(const Expr &a, const Expr &b)
template<typename T> inline std::enable_if<!std::is_base_of< Expr, T >::value &&poplar::TypeTraits::isSimpleType< T >), Divide >::type operator/ (const T &a, const Expr &b)
template<typename T> inline std::enable_if<!std::is_base_of< Expr, T >::value &&poplar::TypeTraits::isSimpleType< T >), Divide >::type operator/ (const Expr &a, const T &b)
inline Divide operator/(const Expr &a, const Expr &b)
template<typename T> inline std::enable_if<!std::is_base_of< Expr, T >::value &&poplar::TypeTraits::isSimpleType< T >), Equal >::type operator== (const T &a, const Expr &b)
template<typename T> inline std::enable_if<!std::is_base_of< Expr, T >::value &&poplar::TypeTraits::isSimpleType< T >), Equal >::type operator== (const Expr &a, const T &b)
inline Equal operator==(const Expr &a, const Expr &b)
template<typename T> inline std::enable_if<!std::is_base_of< Expr, T >::value &&poplar::TypeTraits::isSimpleType< T >), Gte >::type operator>= (const T &a, const Expr &b)
template<typename T> inline std::enable_if<!std::is_base_of< Expr, T >::value &&poplar::TypeTraits::isSimpleType< T >), Gte >::type operator>= (const Expr &a, const T &b)
inline Gte operator>=(const Expr &a, const Expr &b)
template<typename T> inline std::enable_if<!std::is_base_of< Expr, T >::value &&poplar::TypeTraits::isSimpleType< T >), Gt >::type operator> (const T &a, const Expr &b)
template<typename T> inline std::enable_if<!std::is_base_of< Expr, T >::value &&poplar::TypeTraits::isSimpleType< T >), Gt >::type operator> (const Expr &a, const T &b)
inline Gt operator>(const Expr &a, const Expr &b)
template<typename T> inline std::enable_if<!std::is_base_of< Expr, T >::value &&poplar::TypeTraits::isSimpleType< T >), Lte >::type operator<= (const T &a, const Expr &b)
template<typename T> inline std::enable_if<!std::is_base_of< Expr, T >::value &&poplar::TypeTraits::isSimpleType< T >), Lte >::type operator<= (const Expr &a, const T &b)
inline Lte operator<=(const Expr &a, const Expr &b)
template<typename T> inline std::enable_if<!std::is_base_of< Expr, T >::value &&poplar::TypeTraits::isSimpleType< T >), And >::type operator&& (const T &a, const Expr &b)
template<typename T> inline std::enable_if<!std::is_base_of< Expr, T >::value &&poplar::TypeTraits::isSimpleType< T >), And >::type operator&& (const Expr &a, const T &b)
inline And operator&&(const Expr &a, const Expr &b)
template<typename T> inline std::enable_if<!std::is_base_of< Expr, T >::value &&poplar::TypeTraits::isSimpleType< T >), Or >::type operator|| (const T &a, const Expr &b)
template<typename T> inline std::enable_if<!std::is_base_of< Expr, T >::value &&poplar::TypeTraits::isSimpleType< T >), Or >::type operator|| (const Expr &a, const T &b)
inline Or operator||(const Expr &a, const Expr &b)
template<typename T> inline std::enable_if<!std::is_base_of< Expr, T >::value &&poplar::TypeTraits::isSimpleType< T >), Lt >::type operator< (const T &a, const Expr &b)
template<typename T> inline std::enable_if<!std::is_base_of< Expr, T >::value &&poplar::TypeTraits::isSimpleType< T >), Lt >::type operator< (const Expr &a, const T &b)
inline Lt operator<(const Expr &a, const Expr &b)
template<typename T> inline std::enable_if<!std::is_base_of< Expr, T >::value &&poplar::TypeTraits::isSimpleType< T >), Mul >::type operator* (const T &a, const Expr &b)
template<typename T> inline std::enable_if<!std::is_base_of< Expr, T >::value &&poplar::TypeTraits::isSimpleType< T >), Mul >::type operator* (const Expr &a, const T &b)
inline Mul operator*(const Expr &a, const Expr &b)
template<typename T> inline std::enable_if<!std::is_base_of< Expr, T >::value &&poplar::TypeTraits::isSimpleType< T >), NotEqual >::type operator!= (const T &a, const Expr &b)
template<typename T> inline std::enable_if<!std::is_base_of< Expr, T >::value &&poplar::TypeTraits::isSimpleType< T >), NotEqual >::type operator!= (const Expr &a, const T &b)
inline NotEqual operator!=(const Expr &a, const Expr &b)
template<typename T> inline std::enable_if<!std::is_base_of< Expr, T >::value &&poplar::TypeTraits::isSimpleType< T >), Rem >::type operator% (const T &a, const Expr &b)
template<typename T> inline std::enable_if<!std::is_base_of< Expr, T >::value &&poplar::TypeTraits::isSimpleType< T >), Rem >::type operator% (const Expr &a, const T &b)
inline Rem operator%(const Expr &a, const Expr &b)
template<typename T> inline std::enable_if<!std::is_base_of< Expr, T >::value &&poplar::TypeTraits::isSimpleType< T >), Shl >::type operator<< (const T &a, const Expr &b)
template<typename T> inline std::enable_if<!std::is_base_of< Expr, T >::value &&poplar::TypeTraits::isSimpleType< T >), Shl >::type operator<< (const Expr &a, const T &b)
inline Shl operator<<(const Expr &a, const Expr &b)
template<typename T> inline std::enable_if<!std::is_base_of< Expr, T >::value &&poplar::TypeTraits::isSimpleType< T >), Shr >::type operator>> (const T &a, const Expr &b)
template<typename T> inline std::enable_if<!std::is_base_of< Expr, T >::value &&poplar::TypeTraits::isSimpleType< T >), Shr >::type operator>> (const Expr &a, const T &b)
inline Shr operator>>(const Expr &a, const Expr &b)
template<typename T> inline std::enable_if<!std::is_base_of< Expr, T >::value &&poplar::TypeTraits::isSimpleType< T >), Sub >::type operator- (const T &a, const Expr &b)
template<typename T> inline std::enable_if<!std::is_base_of< Expr, T >::value &&poplar::TypeTraits::isSimpleType< T >), Sub >::type operator- (const Expr &a, const T &b)
inline Sub operator-(const Expr &a, const Expr &b)
class Abs : public popops::expr::UnaryOp

Public Functions

inline Abs(const Expr &a)
class Add : public popops::expr::BinaryOp

Public Functions

inline Add(const Expr &a, const Expr &b)
class And : public popops::expr::BinaryOp

Public Functions

inline And(const Expr &a, const Expr &b)
class Any
#include <Expr.hpp>

A class that can contain any expression, useful for building up expression trees dynamically where the type of the outermost expression may change.

Public Functions

inline Any(const Expr &expr)
inline Any(const Any &expr)
Any(Any&&) = default
inline Any &operator=(const Any &other)
Any &operator=(Any &&other) = default
inline operator Expr&()
inline operator const Expr&() const
inline std::string name(const std::vector<poplar::Tensor> &inputs) const

Private Members

std::unique_ptr<Expr> expr
class Asin : public popops::expr::UnaryOp

Public Functions

inline Asin(const Expr &a)
class Atan2 : public popops::expr::BinaryOp

Public Functions

inline Atan2(const Expr &a, const Expr &b)
class BinaryOp : public popops::expr::ExprType<BinaryOp>
#include <Expr.hpp>

A class to represent expressions with binary operators.

Subclassed by popops::expr::Add, popops::expr::And, popops::expr::Atan2, popops::expr::BitwiseAnd, popops::expr::BitwiseOr, popops::expr::BitwiseXnor, popops::expr::BitwiseXor, popops::expr::Divide, popops::expr::Equal, popops::expr::Gt, popops::expr::Gte, popops::expr::InvStdDevToVariance, popops::expr::Lt, popops::expr::Lte, popops::expr::Max, popops::expr::Min, popops::expr::Mul, popops::expr::NotEqual, popops::expr::Or, popops::expr::Pow, popops::expr::Rem, popops::expr::Shl, popops::expr::Shr, popops::expr::ShrSE, popops::expr::Sub, popops::expr::VarianceToInvStdDev

Public Functions

inline BinaryOp(BinaryOpType type, const Expr &a, const Expr &b)
BinaryOp(BinaryOp&&) = default
BinaryOp &operator=(BinaryOp&&) = default
inline BinaryOp(const BinaryOp &other)
inline BinaryOp &operator=(const BinaryOp &other)
inline BinaryOpType getOpType() const
inline const Expr &getLHS() const
inline const Expr &getRHS() const
inline virtual std::unique_ptr<Expr> clone() const override
virtual std::string name(const std::vector<poplar::Tensor> &inputs) const override
inline std::string exprName(const std::vector<poplar::Tensor> &inputs) const
virtual bool deepEquals(const Expr &other) const override
virtual void print(std::ostream &os, unsigned indent = 0, bool prettyPrint = true) const override

Private Members

BinaryOpType type
std::unique_ptr<Expr> a
std::unique_ptr<Expr> b
class BitwiseAnd : public popops::expr::BinaryOp

Public Functions

inline BitwiseAnd(const Expr &a, const Expr &b)
class BitwiseNot : public popops::expr::UnaryOp

Public Functions

inline BitwiseNot(const Expr &a)
class BitwiseOr : public popops::expr::BinaryOp

Public Functions

inline BitwiseOr(const Expr &a, const Expr &b)
class BitwiseXnor : public popops::expr::BinaryOp

Public Functions

inline BitwiseXnor(const Expr &a, const Expr &b)
class BitwiseXor : public popops::expr::BinaryOp

Public Functions

inline BitwiseXor(const Expr &a, const Expr &b)
class Cast : public popops::expr::ExprType<Cast>
#include <Expr.hpp>

A class to represent cast expressions.

Public Functions

inline Cast(const Expr &a_, const poplar::Type bType_)
Cast(Cast &&other) = default
Cast &operator=(Cast &&other) = default
inline Cast(const Cast &other)
inline Cast &operator==(const Cast &other)
inline const Expr &getLHS() const
inline const poplar::Type &getRHSType() const
inline virtual std::unique_ptr<Expr> clone() const override
virtual std::string name(const std::vector<poplar::Tensor> &inputs) const override
virtual bool deepEquals(const Expr &other) const override
virtual void print(std::ostream &os, unsigned indent = 0, bool prettyPrint = true) const override

Private Members

std::unique_ptr<Expr> a
poplar::Type bType
class Cbrt : public popops::expr::UnaryOp

Public Functions

inline Cbrt(const Expr &a)
class Ceil : public popops::expr::UnaryOp

Public Functions

inline Ceil(const Expr &a)
class Clamp : public popops::expr::TernaryOp

Public Functions

inline Clamp(const Expr &a, const Expr &b, const Expr &c)
class Const : public popops::expr::ExprType<Const>
#include <Expr.hpp>

A class to represent constant expressions.

Subclassed by popops::expr::ConstHalf

Public Functions

template<typename T, typename = typename std::enable_if<poplar::TypeTraits::isSimpleType<T>(), T>::type>
inline Const(T x)
inline Const(poplar::TypeTraits typeTraits_, poplar::Type type_, const char *data_)
Const(Const&&) = default
Const &operator=(Const&&) = default
inline Const(const Const &other)
inline Const &operator=(const Const &other)
inline char *getData() const
inline const poplar::TypeTraits &getTypeTraits() const
inline const poplar::Type &getType() const
std::string printValue() const
double getDataAsDouble() const
std::uint64_t getDataForUnsignedIntegral() const
inline virtual std::unique_ptr<Expr> clone() const override
virtual std::string name(const std::vector<poplar::Tensor>&) const override
virtual bool deepEquals(const Expr &other) const override
virtual void print(std::ostream &os, unsigned indent = 0, bool prettyPrint = true) const override

Protected Functions

template<typename T>
inline Const(T x, bool isHalfType)

Private Members

poplar::TypeTraits typeTraits
poplar::Type type
std::unique_ptr<char[]> data
class ConstHalf : public popops::expr::Const
#include <Expr.hpp>

A class to represent constant expressions of type half.

Public Functions

inline ConstHalf(float x)
ConstHalf(ConstHalf&&) = default
ConstHalf &operator=(ConstHalf&&) = default
inline ConstHalf(const ConstHalf &other)
inline ConstHalf &operator=(const ConstHalf &other)
class Cos : public popops::expr::UnaryOp

Public Functions

inline Cos(const Expr &a)
class Divide : public popops::expr::BinaryOp

Public Functions

inline Divide(const Expr &a, const Expr &b)
class Equal : public popops::expr::BinaryOp

Public Functions

inline Equal(const Expr &a, const Expr &b)
class Erf : public popops::expr::UnaryOp

Public Functions

inline Erf(const Expr &a)
class Exp : public popops::expr::UnaryOp

Public Functions

inline Exp(const Expr &a)
class Exp2 : public popops::expr::UnaryOp

Public Functions

inline Exp2(const Expr &a)
class Expm1 : public popops::expr::UnaryOp

Public Functions

inline Expm1(const Expr &a)
class Expr
#include <Expr.hpp>

Type to represent element expressions.

This class represents an expression that can be applied to elements of tensors.

The Expr type is an abstract type which can be instantiated by its sub-classes to build up expressions, for example: Tanh(Add(Square(_1), Const(3)))).

Expressions can be applied to tensors with the popops::map() and popops::mapInPlace() functions.

Subclassed by popops::expr::ExprType< BinaryOp >, popops::expr::ExprType< Cast >, popops::expr::ExprType< Const >, popops::expr::ExprType< PlaceHolder >, popops::expr::ExprType< TernaryOp >, popops::expr::ExprType< UnaryOp >, popops::expr::ExprType< T >

Public Functions

virtual ~Expr()
template<class T>
inline bool isA() const
template<class T>
inline T *getAs()
template<class T>
inline const T *getAs() const
virtual std::unique_ptr<Expr> clone() const = 0
virtual std::string name(const std::vector<poplar::Tensor>&) const = 0
virtual bool deepEquals(const Expr &other) const = 0
virtual void print(std::ostream &os, unsigned indent = 0, bool prettyPrint = true) const = 0

Protected Types

using ExprClassID = void (*)(void)

Protected Functions

inline Expr(ExprClassID classId)

Protected Attributes

ExprClassID classId
template<class T>
class ExprType : public popops::expr::Expr

Subclassed by popops::expr::BinaryOp, popops::expr::Cast, popops::expr::Const, popops::expr::PlaceHolder, popops::expr::TernaryOp, popops::expr::UnaryOp

Public Functions

inline ExprType()

Private Static Functions

static void loc()
static inline ExprClassID getClassId()

Friends

friend class Expr
class Floor : public popops::expr::UnaryOp

Public Functions

inline Floor(const Expr &a)
class GeluErf : public popops::expr::UnaryOp

Public Functions

inline GeluErf(const Expr &a)
class Gt : public popops::expr::BinaryOp

Public Functions

inline Gt(const Expr &a, const Expr &b)
class Gte : public popops::expr::BinaryOp

Public Functions

inline Gte(const Expr &a, const Expr &b)
class Inv : public popops::expr::UnaryOp

Public Functions

inline Inv(const Expr &a)
class InvStdDevToVariance : public popops::expr::BinaryOp

Public Functions

inline InvStdDevToVariance(const Expr &a, const Expr &b)
class IsFinite : public popops::expr::UnaryOp

Public Functions

inline IsFinite(const Expr &a)
class IsInf : public popops::expr::UnaryOp

Public Functions

inline IsInf(const Expr &a)
class IsNaN : public popops::expr::UnaryOp

Public Functions

inline IsNaN(const Expr &a)
class Log : public popops::expr::UnaryOp

Public Functions

inline Log(const Expr &a)
class Log1p : public popops::expr::UnaryOp

Public Functions

inline Log1p(const Expr &a)
class Lt : public popops::expr::BinaryOp

Public Functions

inline Lt(const Expr &a, const Expr &b)
class Lte : public popops::expr::BinaryOp

Public Functions

inline Lte(const Expr &a, const Expr &b)
class Max : public popops::expr::BinaryOp

Public Functions

inline Max(const Expr &a, const Expr &b)
class Min : public popops::expr::BinaryOp

Public Functions

inline Min(const Expr &a, const Expr &b)
class Mul : public popops::expr::BinaryOp

Public Functions

inline Mul(const Expr &a, const Expr &b)
class Neg : public popops::expr::UnaryOp

Public Functions

inline Neg(const Expr &a)
class Not : public popops::expr::UnaryOp

Public Functions

inline Not(const Expr &a)
class NotEqual : public popops::expr::BinaryOp

Public Functions

inline NotEqual(const Expr &a, const Expr &b)
class Or : public popops::expr::BinaryOp

Public Functions

inline Or(const Expr &a, const Expr &b)
class PlaceHolder : public popops::expr::ExprType<PlaceHolder>

Public Functions

inline PlaceHolder(unsigned index)
PlaceHolder(PlaceHolder&&) = default
PlaceHolder &operator=(PlaceHolder&&) = default
inline PlaceHolder(const PlaceHolder &other)
inline PlaceHolder &operator=(const PlaceHolder &other)
inline unsigned getIndex() const
inline std::unique_ptr<Expr> clone() const override
std::string name(const std::vector<poplar::Tensor> &inputs) const override
bool deepEquals(const Expr &other) const override
void print(std::ostream &os, unsigned indent = 0, bool prettyPrint = true) const override

Private Members

unsigned index
class Pow : public popops::expr::BinaryOp

Public Functions

inline Pow(const Expr &a, const Expr &b)
class Rem : public popops::expr::BinaryOp

Public Functions

inline Rem(const Expr &a, const Expr &b)
class Round : public popops::expr::UnaryOp

Public Functions

inline Round(const Expr &a)
class Rsqrt : public popops::expr::UnaryOp

Public Functions

inline Rsqrt(const Expr &a)
class Select : public popops::expr::TernaryOp
#include <Expr.hpp>

Computes the conditional ternary operation.

c ? a : b

Public Functions

inline Select(const Expr &a, const Expr &b, const Expr &c)
class Shl : public popops::expr::BinaryOp

Public Functions

inline Shl(const Expr &a, const Expr &b)
class Shr : public popops::expr::BinaryOp

Public Functions

inline Shr(const Expr &a, const Expr &b)
class ShrSE : public popops::expr::BinaryOp

Public Functions

inline ShrSE(const Expr &a, const Expr &b)
class Sigmoid : public popops::expr::UnaryOp

Public Functions

inline Sigmoid(const Expr &a)
class Signum : public popops::expr::UnaryOp

Public Functions

inline Signum(const Expr &a)
class Sin : public popops::expr::UnaryOp

Public Functions

inline Sin(const Expr &a)
class Sqrt : public popops::expr::UnaryOp

Public Functions

inline Sqrt(const Expr &a)
class Square : public popops::expr::UnaryOp

Public Functions

inline Square(const Expr &a)
class Sub : public popops::expr::BinaryOp

Public Functions

inline Sub(const Expr &a, const Expr &b)
class Tan : public popops::expr::UnaryOp

Public Functions

inline Tan(const Expr &a)
class Tanh : public popops::expr::UnaryOp

Public Functions

inline Tanh(const Expr &a)
class TernaryOp : public popops::expr::ExprType<TernaryOp>
#include <Expr.hpp>

A class to represent expressions with ternary operators.

Subclassed by popops::expr::Clamp, popops::expr::Select

Public Functions

inline TernaryOp(TernaryOpType type, const Expr &a, const Expr &b, const Expr &c)
TernaryOp(TernaryOp&&) = default
TernaryOp &operator=(TernaryOp&&) = default
inline TernaryOp(const TernaryOp &other)
inline TernaryOp &operator=(const TernaryOp &other)
inline TernaryOpType getOpType() const
inline const Expr &getArg0() const
inline const Expr &getArg1() const
inline const Expr &getArg2() const
inline virtual std::unique_ptr<Expr> clone() const override
virtual std::string name(const std::vector<poplar::Tensor> &inputs) const override
inline std::string exprName(const std::vector<poplar::Tensor> &inputs) const
virtual bool deepEquals(const Expr &other) const override
virtual void print(std::ostream &os, unsigned indent = 0, bool prettyPrint = true) const override

Private Members

TernaryOpType type
std::unique_ptr<Expr> a
std::unique_ptr<Expr> b
std::unique_ptr<Expr> c
class Trunc : public popops::expr::UnaryOp

Public Functions

inline Trunc(const Expr &a)
class UnaryOp : public popops::expr::ExprType<UnaryOp>
#include <Expr.hpp>

A class to represent expressions with unary operators.

Subclassed by popops::expr::Abs, popops::expr::Asin, popops::expr::BitwiseNot, popops::expr::Cbrt, popops::expr::Ceil, popops::expr::Cos, popops::expr::Erf, popops::expr::Exp, popops::expr::Exp2, popops::expr::Expm1, popops::expr::Floor, popops::expr::GeluErf, popops::expr::Inv, popops::expr::IsFinite, popops::expr::IsInf, popops::expr::IsNaN, popops::expr::Log, popops::expr::Log1p, popops::expr::Neg, popops::expr::Not, popops::expr::Round, popops::expr::Rsqrt, popops::expr::Sigmoid, popops::expr::Signum, popops::expr::Sin, popops::expr::Sqrt, popops::expr::Square, popops::expr::Tan, popops::expr::Tanh, popops::expr::Trunc

Public Functions

inline UnaryOp(UnaryOpType type, const Expr &a)
UnaryOp(UnaryOp&&) = default
UnaryOp &operator=(UnaryOp&&) = default
inline UnaryOp(const UnaryOp &other)
inline UnaryOp &operator=(const UnaryOp &other)
inline UnaryOpType getOpType() const
inline const Expr &getArg() const
inline virtual std::unique_ptr<Expr> clone() const override
virtual std::string name(const std::vector<poplar::Tensor> &inputs) const override
inline std::string exprName(const std::vector<poplar::Tensor> &inputs) const
virtual bool deepEquals(const Expr &other) const override
virtual void print(std::ostream &os, unsigned indent = 0, bool prettyPrint = true) const override

Private Members

UnaryOpType type
std::unique_ptr<Expr> a
class VarianceToInvStdDev : public popops::expr::BinaryOp

Public Functions

inline VarianceToInvStdDev(const Expr &a, const Expr &b)