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.
-
namespace expr
Functions
- 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)
- 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)
- 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)
- 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)
- 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)
- 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)
- 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)
- 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)
- 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)
- 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)
- 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)
- 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)
- 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)
- 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)
- 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)
- 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)
- 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)
-
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
-
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)
-
inline BinaryOpType getOpType() const
-
inline BinaryOp(BinaryOpType type, const Expr &a, const Expr &b)
-
class Cast : public popops::expr::ExprType<Cast>
- #include <Expr.hpp>
A class to represent cast expressions.
Public Functions
-
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_)
-
inline char *getData() const
-
inline const poplar::TypeTraits &getTypeTraits() const
-
double getDataAsDouble() const
-
template<typename T, typename = typename std::enable_if<poplar::TypeTraits::isSimpleType<T>(), T>::type>
-
class ConstHalf : public popops::expr::Const
- #include <Expr.hpp>
A class to represent constant expressions of type
half
.
-
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 >
Protected Types
-
using ExprClassID = void (*)(void)
Protected Functions
-
inline Expr(ExprClassID classId)
Protected Attributes
-
ExprClassID classId
-
using ExprClassID = void (*)(void)
-
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()
Friends
- friend class Expr
-
inline ExprType()
-
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
Private Members
-
unsigned index
-
inline PlaceHolder(unsigned index)
-
class Select : public popops::expr::TernaryOp
- #include <Expr.hpp>
Computes the conditional ternary operation.
c ? a : b
-
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)
-
inline TernaryOpType getOpType() const
-
inline TernaryOp(TernaryOpType type, const Expr &a, const Expr &b, const Expr &c)
-
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::NearbyInt, 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)
-
inline UnaryOpType getOpType() const
-
inline UnaryOp(UnaryOpType type, const Expr &a)
-
namespace expr