# 4. PopLibs API reference¶

The PopLibs libraries provide application-level functions that can be used in Poplar programs for the IPU.

Library

Depends on

Description

`poplin`

`popops`, `poputil`

Linear algebra functions (matrix multiplications, convolutions)

`popnn`

`poplin`, `poputil`

Functions used in neural networks (for example, non-linearities, pooling and loss functions)

`popops`

`poputil`

Operations on tensors in control programs (elementwise functions and reductions)

`poprand`

`poputil`

Functions for populating tensors with random numbers

`popsparse`

Functions for operating on sparse tensors

`poputil`

General utility functions for building graphs

## Utility functions (poputil)¶

General utility functions for building graphs.

Functions to provide numpy-like tensor matching and broadcasting.

namespace `poputil`

General utility functions for building graphs.

Functions

void `expandToMatchRanks`(poplar::Tensor &a, poplar::Tensor &b)

Match dimensions of two tensors using numpy-style expansion rules.

Insert singleton dimensions into either of the two tensors so that their ranks match, following numpy-style expansion rules. The tensor with the lower rank has singleton dimensions inserted as the outermost dimensions.

Parameters
• `a`: First tensor to match.

• `b`: Second tensor to match.

void `broadcastToMatch`(poplar::Tensor &a, const std::vector<std::size_t> &shape)

Match dimensions of a tensor to a shape using numpy-style broadcast rules:

1) If the rank of the tensor is less than the required shape then expand to the left by adding dimensions of size 1 to match the rank required.

2) For each dimension, the size of the dimension in the tensor must be the same as the required shape or must be 1. In the case where it is of size 1, the tensor is broadcast in that dimension to match the shape. If neither of these conditions hold then an exception is thrown.

Parameters
• `a`: The tensor to broadcast to match the shape. This will be updated in place with broadcast dimensions.

• `shape`: The shape to match.

Exceptions
• `poputil::poplibs_error`: If `a` cannot be broadcast to match `shape`.

void `broadcastToMatch`(poplar::Tensor &a, poplar::Tensor &b)

Match dimensions of two tensors using numpy-style broadcast rules:

1) If the rank of one tensor is less than the other then extend the dimensions to the left with dimensions of size 1 to match the rank required.

2) For each dimension, the size of each dimension in both tensors must be the same or one of them must have size 1. In the case where one is of size 1, the tensor is broadcast in that dimension to match the other. If neither of these conditions hold then an exception is thrown.

Parameters
• `a`: First tensor to match. This will be updated in place with broadcast dimensions.

• `b`: Second tensor to match. This will be updated in place with broadcast dimensions.

Exceptions
• `poputil::poplibs_error`: If `a` cannot be broadcast to match a dimension.

void `broadcastToMatch`(poplar::Tensor &a, poplar::Tensor &b, poplar::Tensor &c)

Match dimensions of three tensors using numpy-style broadcast rules:

1) If the rank of one tensor is less than the other then extend the dimensions to the left with dimensions of size 1 to match the rank required.

2) For each dimension, the size of each dimension in both tensors must be the same or one of them must have size 1. In the case where one is of size 1, the tensor is broadcast in that dimension to match the other. If neither of these conditions hold then an exception is thrown.

Parameters
• `a`: First tensor to match. This will be updated in place with broadcast dimensions.

• `b`: Second tensor to match. This will be updated in place with broadcast dimensions.

• `c`: Third tensor to match. This will be updated in place with broadcast dimensions.

Exceptions
• `poputil::poplibs_error`: If `a` cannot be broadcast to match a dimension.

bool `canBroadcastToMatch`(const poplar::Tensor &a, const poplar::Tensor &b)

Test if the given tensors can be broadcast to match one another using the rules for broadcastToMatch().

Return

True if the two tensors may be broadcast to match one another and false if they cannot be matched with the broadcastToMatch() rules.

Parameters
• `a`: First tensor to match.

• `b`: Second tensor to match.

### poputil/GraphFunction.hpp¶

namespace `poputil`

General utility functions for building graphs.

namespace `graphfn`

Support for using poplar::Program objects like function calls.

Typedefs

using `Signature` = std::vector<ArgSig>

Enums

enum `ArgType`

Type of argument to function program.

Values:

enumerator `InputArg`
enumerator `OutputArg`
enumerator `InOutArg`
enumerator `CreatedArg`

Functions

ArgSig `input`(poplar::Tensor similar, std::string debugName = "")
ArgSig `inout`(poplar::Tensor similar, std::string debugName = "")
ArgSig `output`(poplar::Tensor similar, std::string debugName = "")
ArgSig `created`(std::string debugName = "")
struct `ArgSig`

Public Functions

`ArgSig`(ArgType type, poplar::Tensor tensor, std::string debugName)

Public Members

ArgType `type`
poplar::Tensor `similarTensor`
std::string `debugName`
class `ProgramFunction`

Public Functions

`ProgramFunction`(poplar::Graph &graph, Signature sig, std::function<poplar::program::Program(std::vector<poplar::Tensor>&)> f, bool inlined = false, const poplar::DebugContext &debugContext = {}, )
`ProgramFunction`(poplar::Graph &graph, Signature sig, std::function<poplar::program::Program(std::vector<poplar::Tensor>&, const poplar::DebugNameAndId&)> f, bool inlined = false, const poplar::DebugContext &debugContext = {}, )
poplar::program::Program `operator()`(std::vector<poplar::Tensor> &args, const poplar::DebugContext &debugContext = {})

Private Members

VoidFunction `voidFunc`
class `TensorFunction`

Public Functions

`TensorFunction`(poplar::Graph &graph, Signature sig, std::function<poplar::Tensor(std::vector<poplar::Tensor>&, poplar::program::Sequence&)> f, bool inlined = false, const poplar::DebugContext &debugContext = {}, )
`TensorFunction`(poplar::Graph &graph, Signature sig, std::function<poplar::Tensor(std::vector<poplar::Tensor>&, poplar::program::Sequence&, const poplar::DebugNameAndId&)> f, bool inlined = false, const poplar::DebugContext &debugContext = {}, )
poplar::Tensor `operator()`(std::vector<poplar::Tensor> &args, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {})

Private Members

VoidFunction `voidFunc`
class `VoidFunction`

Public Functions

`VoidFunction`(VoidFunction &&fn)
`VoidFunction`(poplar::Graph &graph, Signature sig, std::function<void(std::vector<poplar::Tensor>&, poplar::program::Sequence&)> f, bool inlined = false, const poplar::DebugContext &debugContext = {}, )
`VoidFunction`(poplar::Graph &graph, Signature sig, std::function<void(std::vector<poplar::Tensor>&, poplar::program::Sequence&, const poplar::DebugNameAndId&)> f, bool inlined = false, const poplar::DebugContext &debugContext = {}, )
void `operator()`(std::vector<poplar::Tensor> &args, poplar::program::Sequence &seq, const poplar::DebugContext &dc = {})

Private Members

poplar::Graph &`graph`
Signature `sig`
bool `inlined`
poplar::program::Sequence `prog`
poplar::Function `func`
std::vector<poplar::Tensor> `params`

### poputil/OptionParsing.hpp¶

OptionSpec/OptionHandler used to build up a specification of what options and their values should be, and to translate the value strings to real values.

namespace `poplibs`

PopLibs classes and functions.

class `OptionHandler`
#include <OptionParsing.hpp>

Represents the various options types.

Public Functions

template<typename `T`>
`OptionHandler`(T &&valueHandler)
void `parseValue`(poplar::StringRef value) const

Public Static Functions

template<typename `T`>
std::string `describeEnumValues`(const std::map<std::string, T> &valueMap)
template<typename `T`, typename `ValueMapT` = std::map<std::string, T>>
OptionHandler `createWithEnum`(T &output, ValueMapT &&valueMap)
template<typename `T`>
OptionHandler `createWithInteger`(T &output)
template<typename `T`>
OptionHandler `createWithBool`(T &output)
template<typename `T`>
OptionHandler `createWithDouble`(T &output)
OptionHandler `createWithString`(std::string &output)
template<typename `T`>
OptionHandler `createWithList`(std::vector<T> &output)

Private Members

std::function<void(poplar::StringRef)> `valueHandler`
class `OptionSpec`
#include <OptionParsing.hpp>

Represents a set of options and their values.

Public Functions

`OptionSpec`(initializer_list_t &&handlers)
void `parse`(poplar::StringRef option, poplar::StringRef value, bool ignoreUnknown = false) const

Private Types

using `value_type` = std::pair<const std::string, OptionHandler>
using `map_type` = std::map<const std::string, OptionHandler>
using `initializer_list_t` = std::initializer_list<value_type>

Private Members

map_type `handlers`
namespace `parse`

Functions

template<typename `T`>
T `asInteger`(const poplar::StringRef &str)
template<typename `T`>
T `asFloatingPoint`(const poplar::StringRef &str)

Class to allow extra data to be associated with a tensor.

namespace `poputil`

General utility functions for building graphs.

class `TensorMetaData`

Class used to represent some unspecified form of meta-data for a tensor.

Public Functions

`TensorMetaData`()
`TensorMetaData`(const TensorMetaData &other)
`TensorMetaData`(TensorMetaData &&other)
TensorMetaData &`operator=`(const TensorMetaData &other)
TensorMetaData &`operator=`(TensorMetaData &&other)
`TensorMetaData`(std::unique_ptr<TensorMetaDataBase> data)
`~TensorMetaData`()
const TensorMetaDataBase *`getData`() const

Private Members

std::unique_ptr<TensorMetaDataBase> `data`

### poputil/TileMapping.hpp¶

Functions for handling the mapping of tensors to tiles.

namespace `poputil`

General utility functions for building graphs.

Functions

std::vector<std::vector<poplar::Interval>> `calcLinearTileMapping`(const poplar::Graph &graph, std::vector<std::size_t> shape, unsigned minElementsPerTile, unsigned grainSize)

Calculate a tile mapping that spreads the tensor evenly over the tiles in a graph.

The indices of the flattened tensor are mapped from low to high tile numbers.

Return

A vector containing

Parameters
• `graph`: The graph to calculate the mapping for.

• `shape`: The shape of the tensor to be mapped: a vector containing the size of each dimension of the tensor.

• `minElementsPerTile`: The minimum number of tensor elements to be allocated to a tile.

• `grainSize`: The number of elements mapped to each tile will be an integer multiple of the grain size.

std::vector<std::vector<poplar::Interval>> `calcLinearTileMapping`(const poplar::Graph &graph, const poplar::Tensor &t)

Calculate a tile mapping that spreads the tensor evenly over the tiles in a graph.

The indices of the flattened tensor are mapped from low to high tile numbers.

In this case the elements are distributed so that groups of elements of the device’s natural vector width will not be split. It effectively sets the grain size to the natural vector width for the data type. This means the number of elements on each tile will be a multiple of the natural vector width and the index of the first element is aligned to the natural vector width.

The natural vector width is the largest vector width supported in hardware for arithmetic operations on that data type.

It will also try to keep at least 128 bytes of data on each tile to avoid high exchange costs.

Parameters
• `graph`: The graph to add the operation to.

• `shape`: The tensor to be mapped.

void `mapTensorLinearly`(poplar::Graph &graph, const poplar::Tensor &t, unsigned minElementsPerTile, unsigned grainSize)
void `mapTensorLinearly`(poplar::Graph &graph, const poplar::Tensor &t)
unsigned `getTileImbalance`(const poplar::Graph::TileToTensorMapping &mapping, unsigned minElementsPerTile = 0, unsigned grainSize = 1)

Determine how unbalanced a tensor is when mapped over tiles in a graph.

This reports how well a tensor mapping compares with the mapping based on a given number of elements per tile.

Return

The maximum number of elements greater than expected on any tile.

Parameters
• `mapping`: The current tile mapping of the tensor.

• `minElementsPerTile`: The suggested minimum number of elements per tile.

• `grainSize`: The number of elements mapped to each tile would be an integer multiple of the suggested grain size.

unsigned `getTileImbalance`(const poplar::Graph &graph, const poplar::Tensor &t, unsigned minElementsPerTile = 0, unsigned grainSize = 1)

Determine how unbalanced a tensor is mapped over tiles.

This compares the way a tensor is mapped to a set of tiles to the mapping based on a given number of elements per tile.

Return

The maximum number of elements greater than expected on any tile.

Parameters
• `graph`: The graph containing the mapped tensor.

• `mapping`: The tensor currently mapped to tiles in the graph.

• `minElementsPerTile`: The suggested minimum number of elements per tile.

• `grainSize`: The number of elements mapped to each tile would be an integer multiple of the suggested grain size.

poplar::Tensor `cloneToIpu`(poplar::Graph &graph, const poplar::Tensor &t, unsigned dstIPU, const poplar::DebugContext &debugContext = {}, poplar::TensorCloneMethod method = poplar::TensorCloneMethod::PRESERVE_ORDER_UNLESS_ALIASES)

Create a clone of the specified tensor on the specified IPU.

The cloned tensor is mapped to the IPU in such a way that the mapping of tensor elements to tiles is preserved.

Return

The cloned tensor.

Parameters
• `graph`: The graph representing the entire multi-IPU device.

• `t`: The tensor to clone.

• `dstIPU`: The index of the IPU to clone the tensor onto.

• `name`: A debug name to give to any new tensors allocated in the graph during the clone. If this is empty then the debug names will be derived from existing tensor debug names.

• `method`: The method to use for the cloning.

poplar::Tensor `cloneToGraph`(poplar::Graph &srcGraph, poplar::Graph &dstGraph, const poplar::Tensor &t, const poplar::DebugContext &debugContext = {}, poplar::TensorCloneMethod method = poplar::TensorCloneMethod::PRESERVE_ORDER_UNLESS_ALIASES)

Create a clone of the specified tensor on the specified graph.

The cloned tensor is mapped to the destination graph in such a way that the mapping of tensor elements to tiles is preserved.

Return

The cloned tensor.

Note

It is assumed that the destination graph has enough tiles to clone the input tensor. This includes any gaps in the tile mapping. This means the maximum mapped tile of `t` in the source graph must be less than `dstGraph.getTarget().getNumTiles()`.

Parameters
• `srcGraph`: The graph representing the source tiles.

• `dstGraph`: The graph representing the destination tiles.

• `t`: The tensor to clone.

• `debugContext`: Optional debug information

• `method`: The method to use for the cloning.

poplar::Tensor `copyToIpu`(poplar::Graph &masterGraph, const poplar::Tensor &t, poplar::program::Sequence &prog, unsigned dstIPU, const poplar::DebugContext &debugContext = {}, poplar::TensorCloneMethod method = poplar::TensorCloneMethod::PRESERVE_ORDER_UNLESS_ALIASES)

Move a tensor from one IPU to another.

The tensor is moved by duplicating it, mapping the clone onto another IPU, and copying the original tensor values to the new one.

Return

The new tensor on the specified IPU.

Parameters
• `masterGraph`: The graph representing the entire multi-IPU device.

• `t`: The tensor to move from one IPU to another.

• `prog`: A program sequence to add the Copy to.

• `dstIPU`: The index of the IPU onto which the tensor will be moved.

• `debugContext`: A debug name to give to the tensor created on dstIPU. If this is empty then the debug names will be derived from existing tensor debug names.

• `method`: The method to use for cloning of the tensor on the destination IPU.

poplar::Tensor `createIpuCopy`(poplar::Graph &graph, const poplar::Tensor &t, unsigned dstIpu, poplar::Tensor &copySrc, poplar::Tensor &copyDst, const poplar::DebugContext &debugContext = {}, poplar::TensorCloneMethod method = poplar::TensorCloneMethod::PRESERVE_ORDER_AND_ALIASES)

Prepare to move a tensor from one IPU to another.

The tensor is duplicated and the clone is mapped onto another IPU. References to source and destination tensors are provided for use by an inter-IPU copy.

The necessary copy operation is not added to the program.

Return

The new tensor on the specified IPU.

Parameters
• `masterGraph`: The graph representing the entire multi-IPU device.

• `t`: The tensor to move from one IPU to another.

• `dstIPU`: The index of the IPU onto which the tensor will be moved.

• `copySrc`: A tensor that can be used as the source to do the copy.

• `copyDst`: A tensor that can be used as the destination of the copy.

• `debugContext`: A debug name to give to the tensor created on dstIPU. If this is empty then the debug names will be derived from existing tensor debug names.

• `method`: The method to use for cloning of the tensor on the destination IPU.

bool `dimIsSplitOverTiles`(const poplar::Graph &graph, const poplar::Tensor &t, unsigned dimension)

Check if a dimension of a tensor is split over more than one tile.

Examines the mapping of the specified tensor to see if the specified dimension is split over more than one tile.

Return

True if elements of the given dimension are spread over more than one tile.

Parameters
• `graph`: The graph to examine.

• `t`: The tensor to check.

• `dimension`: The dimension to check.

bool `dimIsSplitOverIPUs`(const poplar::Graph &graph, const poplar::Tensor &t, unsigned dimension)

Check if a dimension of a tensor is split over more than one IPU.

Examines the mapping of the specified tensor to see if the specified dimension is split over more than one IPU.

Return

True if elements of the given dimension are spread over more than one IPU.

Parameters
• `graph`: The graph to examine.

• `t`: The tensor to check.

• `dimension`: The dimension to check.

poplar::Tensor `createBroadcastOperand`(poplar::Graph &graph, const poplar::Tensor &fullTensor, const poplar::Type &type, unsigned dim, bool ditherMapping = false, const poplar::DebugContext &debugContext = {})

Create a simpler tensor that is mapped in the same way as another, full, tensor.

The full tensor is typically a left hand side operand of an operation while the created tensor is the right hand side. The created tensor has one dimension, which is the same size as the specified dimension of the full tensor.

Because the created tensor has the same mapping as the full tensor, it reduces the amount of data exchange or copies that are required for an operation using the two tensors.

Return

The created output tensor.

Parameters
• `graph`: The graph which the output tensor is added to.

• `fullTensor`: The tensor mapping for the output tensor is copied from this tensor.

• `type`: The type of the output tensor.

• `dim`: The dimension of the input tensor which is the size of the created tensor.

• `ditherMapping`: Enable dithering to be applied to the mapping of the output tensor.

• `debugContext`: Optional debug information.

class `TensorUseTracker`
#include <TileMapping.hpp>

Class that tracks the usage of data on different tiles.

If data is broadcast to many tiles, it is sometimes efficient to map the data so that it is spread evenly amongst the tiles that use it.

This class can collect information about the use of data and then calculate a suitable tile mapping.

Public Types

enum `MappingMethod`

Values:

enumerator `OptimizeHaloRegions`

Map “halo regions” to single tiles.

These are regions that are used by multiple tiles but have neighbouring regions used by subsets of those tiles.

enumerator `ConstrainMappingToUsedTiles`

Mapping of elements is constrained to be only on tiles that use them.

Otherwise, to meet grain size constraints, elements may be mapped to tiles which do not use them.

enumerator `None`

No mapping method used.

Public Functions

`TensorUseTracker`(unsigned numTiles)
`TensorUseTracker`(const TensorUseTracker &other)
`TensorUseTracker`(TensorUseTracker &&other)
TensorUseTracker &`operator=`(const TensorUseTracker &other)
TensorUseTracker &`operator=`(TensorUseTracker &&other)
`~TensorUseTracker`()
void `add`(const poplar::Graph &graph, unsigned tile, const poplar::Tensor &t)

Add a data use case.

Parameters
• `graph`: The Poplar graph being tracked.

• `tile`: The tile that the use occurs on.

• `t`: The tensor representing the data being used.

void `add`(TensorUseTracker other)

Add data use cases from another tracker.

Parameters
• `other`: The `TensorUseTracker` to merge data use information from.

void `resolve`(const poplar::Graph &graph, unsigned grainSize, unsigned minElementsPerTile, bool extendPartialUsage = false, TensorUseTracker::MappingMethod mappingMethod = TensorUseTracker::MappingMethod::None)

Resolve data uses for mapping.

Data used on multiple tiles will have their uses spread across those tiles.

Parameters
• `graph`: The Poplar graph being tracked.

• `grainSize`: The number of elements mapped to each tile will be an integer multiple of the grain size.

• `minElementsPerTile`: The minimum number of elements that must be mapped to a tile.

• `extendPartialUsage`: When set, partial uses of tensors will be extended to cover the entire tensor, based on the usage of neighbouring regions.

• `mappingMethod`: Method used for mapping elements.

void `mapTensorsByUse`(poplar::Graph &graph, unsigned grainSize, unsigned minElementsPerTile, bool extendPartialUsage = false, TensorUseTracker::MappingMethod mappingMethod = TensorUseTracker::MappingMethod::None)

Map data according to use.

This function will set the tile mapping of variable regions based on tracked data uses. Variable regions with uses on multiple tiles will have their elements spread across those tiles.

Parameters
• `graph`: The Poplar graph being tracked.

• `grainSize`: The number of elements mapped to each tile will be an integer multiple of the grain size.

• `minElementsPerTile`: The minimum number of elements that must be mapped to a tile.

• `extendPartialUsage`: When set, partial uses of tensors will be extended to cover the entire tensor, based on the usage of neighbouring regions before mapping.

• `mappingMethod`: Method used for mapping elements.

bool `empty`() const

Have any use cases been registered.

Return

True if no data use cases, false otherwise

Private Members

std::unique_ptr<TensorUseTrackerState> `st`

### poputil/Util.hpp¶

General operations on tensors.

namespace `poputil`

General utility functions for building graphs.

Functions

void `mergeAdjacentRegions`(std::vector<poplar::Interval> &regions)
void `mergeAdjacentRegions`(std::vector<std::vector<poplar::Interval>> &mapping)
std::vector<poplar::Interval> `flattenIntervals`(const std::vector<std::vector<poplar::Interval>> &intervals)

Flatten a vector of vectors of intervals to a vector, maintaining ordering.

std::vector<std::vector<poplar::Interval>> `splitRegions`(const std::vector<poplar::Interval> &regions, unsigned grainSize, unsigned maxPartitions, unsigned minElementsPerPartition = 0, unsigned maxElementsPerPartition = UINT_MAX, unsigned maxElementsPerRegion = UINT_MAX)

Given a set of contiguous regions, partition these regions while trying to balance the number of elements in each partition and respecting the specified grain size.

At most `maxPartitions` partitions are created. Regions may be split to achieve a better balance.

std::vector<std::vector<poplar::Interval>> `splitRegionsBetweenWorkers`(const poplar::Target &target, const std::vector<poplar::Interval> &regions, unsigned grainSize, unsigned minElementsPerPartition = 0, unsigned maxElementsPerPartition = UINT_MAX, unsigned maxElementsPerRegion = UINT_MAX)

Given a set of contiguous regions per tile, partition these regions between workers on that tile while respecting the specified grain size.

Regions may be split to balance the work across workers.

std::vector<std::vector<std::vector<poplar::Interval>>> `splitRegions`(const std::vector<std::vector<poplar::Interval>> &regions, unsigned grainSize, unsigned maxPartitions, unsigned minElementsPerPartition = 0, unsigned maxElementsPerPartition = UINT_MAX, unsigned maxElementsPerRegion = UINT_MAX)

Given a set of sequences of regions, partition these sequences while trying to balance the number of elements in each partition and respecting the specified grain size.

At most `maxPartitions` partitions are created. Sequences, and regions within them, may be split to achieve a better balance.

std::vector<std::vector<std::vector<poplar::Interval>>> `splitRegionsBetweenWorkers`(const poplar::Target &target, const std::vector<std::vector<poplar::Interval>> &regions, unsigned grainSize, unsigned minElementsPerPartition = 0, unsigned maxElementsPerPartition = UINT_MAX, unsigned maxElementsPerRegion = UINT_MAX)

Given a set of sequences of regions per tile, partition these sequences between workers on that tile while respecting the specified grain size.

Regions may be split to balance the work across workers.

template<class `T`>
std::vector<T> `unflattenIndex`(const std::vector<T> &shape, std::size_t index)

Given an index into a flattened tensor, returns the indices into the dimensions of the original tensor.

template<class `T`>
std::size_t `flattenIndex`(const std::vector<T> &shape, const std::vector<T> &indices)

Given a list of indices into a tensor, return the corresponding index in a flattened version of the tensor.

std::size_t `intervalSequenceNumElements`(const std::vector<std::vector<poplar::Interval>> &seq)

Return the total number of elements in the interval sequence.

poplar::Tensor `duplicate`(poplar::Graph &graph, const poplar::Tensor &in, poplar::program::Sequence &p, const poplar::DebugContext &debugContext = {}, poplar::TensorCloneMethod method = poplar::TensorCloneMethod::PRESERVE_ORDER_UNLESS_ALIASES)

Copy a tensor’s data to a new tensor.

The duplicated tensor has the same tile mapping as the original tensor.

poplar::Tensor `cloneN`(poplar::Graph &graph, const poplar::Tensor &t, unsigned N, const poplar::DebugContext &debugContext = {}, poplar::TensorCloneMethod method = poplar::TensorCloneMethod::PRESERVE_ORDER_UNLESS_ALIASES)

Clone a tensor N times.

Given a tensor of shape [D1, D2, … Dn], this function will create a new tensor of shape [N, D1, D2, …, Dn] where each of the N sub-tensors is a clone of the original tensor (that is, it has the same layout).

Parameters
• `graph`: The Poplar graph.

• `t`: The tensor to clone.

• `N`: The replication factor to clone with.

• `name`: The name for the new variables created.

• `method`: The tensor cloning method (see Graph::clone()).

std::vector<int> `balancedPartition`(int rangeUpperBound, int splitCount)

Split a range.

Utility function to split a range [0, `rangeUpperBound`] into `splitCount` slices as evenly as possible. If `splitCount` does not divide `rangeUpperBound` evenly then output slices are assigned more units in round-robin.

double `castToDeviceHalfValue`(const poplar::Target &target, double input)

Cast a double precision value to a value exactly representable in device HALF type.

Return

Value cast to HALF type on device.

Parameters
• `target`: The target device that the cast will be performed on.

• `input`: Input value.

bool `checkAccuracyWhenCast`(const poplar::Target &target, double input, poplar::Type inputType, poplar::Type outputType, double tolerance)

Check accuracy of a cast operation.

Utility function to check if `input` can be cast from `inputType` to `outputType` without an error in its accuracy, or causing an overflow.

Return

Boolean tensor indicating the error will be less than `tolerance`.

Parameters
• `target`: The target device that the cast will be performed on.

• `input`: Input value.

• `inputType`: Input type before the cast operation.

• `outputType`: Output type after the cast operation.

• `tolerance`: Allowed tolerance in error from cast operation.

Exceptions
• `poputil::poplibs_error`: If either `inputType` or `outputType` are not either half or float.

poplar::Tensor `factorDims`(const poplar::Tensor &t, const std::vector<std::size_t> &factors, unsigned startDim = 0)

Factors the outermost dimensions of tensor `t` by the values given in `factors`.

For each value `f` in `factors`, the corresponding outer dimension is split into two parts of sizes `size(dim)/f` and `f`. The second of these becomes a dimension inside all the factored dimensions. For example, given a tensor with shape [4,6,4] and factors [1,2], we first divide the shape into [4/1,1,6/2,2,4] and then shuffle it to [4/1,6/2,1,2,4].

Return

The refactored tensor.

Parameters
• `t`: The tensor to be factored.

• `factors`: The values to factor each dimension by.

• `startDim`: The outermost dimension to start at.

poplar::Tensor `unfactorDims`(const poplar::Tensor &t, unsigned numDims, unsigned startDim = 0)

The opposite of factorDims().

This does not need information for each dimension because that is present in the tensor. It just needs the number of dimensions.

Return

The refactored tensor.

Parameters
• `t`: The tensor to be refactored.

• `numDims`: The number of dimensions to be refactored.

• `startDim`: The outermost dimension to start at.

### poputil/VarStructure.hpp¶

Manage partitioning and grouping in tensors.

namespace `poputil`

General utility functions for building graphs.

Typedefs

using `GroupingInfo` = std::pair<unsigned, unsigned>

Functions

unsigned `detectInnermostGrouping`(const poplar::Graph &graph, const poplar::Tensor &t)

Detect if the tensor `t` has a grouping in its innermost dimension.

Return

The size of the group. Zero if there is no grouping.

Parameters
• `graph`: The graph to add the function to.

• `t`: The tensor to check for grouping.

Exceptions
• `poputil::poplibs_error`: If the rank of `t` is zero.

std::vector<GroupingInfo> `detectDimGroupings`(const poplar::Graph &graph, const poplar::Tensor &t)

Find all grouped dimensions from the innermost grouped dimension moving outwards, returning groupings for each.

The same dimension may appear more than once. This uses detectInnermostGrouping() iteratively.

Return

A list of the grouped dimensions starting with the innermost.

Parameters
• `graph`: The graph to add the function to.

• `t`: The tensor to check for grouping.

Exceptions
• `poputil::poplibs_error`: If the rank of `t` is zero.

poplar::Tensor `createPartitionableTensor`(poplar::Graph &graph, const poplar::Type &type, const std::vector<std::size_t> &shape, const std::vector<std::size_t> &nPartitions, const poplar::DebugContext &debugContext = {})

Create a tensor with the given shape, so that when it is partitioned into slices according to the given number of partitions in each dimension, each slice is a single contiguous region.

This partitions the tensor so that the maximum number of elements in each partition of a dimension is minimised as well as the number of partitions. That is, if a dimension has `n` elements, and the number of partitions in that dimension is `d` then:

```a * ceil(n/d) + 1 * (n%d) = n
```

There will be `a` partitions with `ceil`(n/d) elements followed by `b` partitions with `floor`(n/d) elements and possibly some number of partitions with 0 elements.

The returned tensor has no tile mapping set.

Return

A tensor with the given shape where each partition is contiguous.

Parameters
• `graph`: The graph to add the variable to.

• `type`: The type of the elements in the returned tensor.

• `shape`: The shape of the returned tensor.

• `nPartitions`: The number of partitions the shape will be partitioned into in each dimension.

• `debugContext`: Optional debug information.

Exceptions
• `poputil::poplibs_error`: If the size of `shape` and `nPartitions` are not equal.

void `iterateTensorPartitions`(const poplar::Tensor &t, const std::vector<std::size_t> &nPartitions, const std::function<void(const std::vector<std::size_t> &i, const poplar::Tensor &s)> &f)

Iterate a function over the partitions of a tensor.

Partitioning follows the same definition as described for createPartitionableTensor().

Parameters
• `t`: The tensor to iterate over.

• `nPartitions`: The number of partitions the tensor is partitioned into in each dimension.

• `i`:

• `f`: A function taking the indices of the partition in the range [0, splits[d]) in each dimension of the tensor as well as the slice of the tensor corresponding to that partition.

Exceptions
• `poputil::poplibs_error`: If the rank of `t` and the size of `nPartitions` are not equal.

### poputil/VertexTemplates.hpp¶

template<>
struct `poputil::``VertexTemplateToString`<poplar::StringRef>

Public Static Functions

std::string `to_string`(const poplar::StringRef &ref)
namespace `poputil`

General utility functions for building graphs.

Functions

std::string `templateVertexParams`(bool first)
template<typename ...`Args`>
std::string `templateVertexParams`(bool first, const std::string &val, Args&&... args)
template<typename ...`Args`>
std::string `templateVertexParams`(bool first, const char *val, Args&&... args)
template<typename ...`Args`>
std::string `templateVertexParams`(bool first, const poplar::Type &type, Args&&... args)
template<typename ...`Args`>
std::string `templateVertexParams`(bool first, bool b, Args&&... args)
template<typename `T`, typename ...`Args`>
std::string `templateVertexParams`(bool first, const T &val, Args&&... args)
template<typename ...`Args`>
std::string `templateVertex`(const std::string &name, Args&&... args)

Generate a string representation of a Vertex type for use by poplar::Graph::addVertex().

Return

A string representation of the vertex type.

Parameters
• `name`: The name of the vertex.

• `args`: The types of the arguments to the vertex.

template<typename `T`>
struct `VertexTemplateToString`

Public Static Functions

std::string `to_string`(const T &x)
`template<> StringRef >`

Public Static Functions

std::string `to_string`(const poplar::StringRef &ref)

## Tensor operations (popops)¶

Functions for building operations on tensors in control programs (such as element-wise functions and reductions).

### popops/AllTrue.hpp¶

Perform logical AND of tensor elements.

namespace `popops`

Common functions, such as elementwise and reductions.

Functions

poplar::Tensor `allTrue`(poplar::Graph &graph, poplar::Tensor A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {})

Given a boolean tensor, compute the logical AND of all its elements.

A new variable is created to store the result.

Return

A variable that holds the result of the operation.

Parameters
• `graph`: The Poplar graph.

• `A`: The boolean tensor.

• `prog`: The program sequence to add this operation to.

• `debugContext`: Optional debug information.

Exceptions
• `poputil::poplibs_error`: If the elements of `A` are not booleans.

### popops/Cast.hpp¶

Casts between tensor types.

namespace `popops`

Common functions, such as elementwise and reductions.

Functions

poplar::Tensor `cast`(poplar::Graph &graph, const poplar::Tensor &src, const poplar::Type &dstType, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {})

Cast elements of the specified `src` tensor to `dstType`, returning the result as a new tensor.

Note: If `dstType == src.elementType()`, then the operation is a copy.

Return

The resultant cast tensor.

Parameters
• `graph`: The graph that the operation will be added to.

• `src`: Source tensor to cast.

• `dstType`: Type of the destination tensor.

• `prog`: Program to add the cast operation to.

• `debugContext`: Optional debug information.

poplar::program::Program `cast`(poplar::Graph &graph, poplar::Tensor src, poplar::Tensor dst, const poplar::DebugContext &debugContext = {})

Create a program to copy tensor casting between types (for example, half->float).

Precondition: `src.shape() == dst.shape()`

Note: If `dst.elementType() == src.elementType()`, then the operation is just a copy.

Return

The program to perform this operation.

Parameters
• `graph`: The graph that the operation will be added to.

• `src`: Source tensor.

• `dst`: Destination tensor.

• `debugContext`: Optional debug information.

void `cast`(poplar::Graph &graph, poplar::Tensor src, poplar::Tensor dst, poplar::ComputeSet cs)

Create vertices to copy element wise from the `src` tensor to the `dst` tensor casting between types (for example, half->float).

The vertices are added to the specified compute set.

Precondition: `src.shape() == dst.shape()`

Parameters
• `graph`: The graph that the operation will be added to.

• `src`: Source tensor.

• `dst`: Destination tensor.

• `cs`: Compute set to add the vertices to.

poplar::Tensor `cast`(poplar::Graph &graph, poplar::Tensor src, const poplar::Type &dstType, poplar::ComputeSet cs, const poplar::DebugContext &debugContext = {})

Create vertices to cast elements of the specified `src` tensor to `dstType`, returning the result as a new tensor.

The vertices are added to the specified compute set.

Return

Resultant destination tensor.

Parameters
• `graph`: The graph that the operation will be added to.

• `src`: Source tensor.

• `dstType`: Destination type.

• `cs`: Compute set to add the vertices to.

• `debugContext`: Optional debug information.

poplar::Tensor `checkAccuracyWhenCast`(poplar::Graph &graph, const poplar::Tensor &input, poplar::Type outputType, double tolerance, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {})

Helper function which checks the relative error in the tensor `input` when casting it to type `outputType`.

The result is a single element bool tensor which is set to true if the error is less than `tolerance`.

Preconditions:

• `input.elementType() == FLOAT`

• `outputType == HALF`

• `input.numElements() == 1`

Return

Boolean tensor indicating that the error is less than `tolerance`.

Parameters
• `graph`: The graph that the operation will be added to.

• `input`: Input tensor.

• `outputType`: Output type after the cast operation.

• `tolerance`: Allowed tolerance in error from cast operation.

• `prog`: Program to add the check onto.

• `debugContext`: Optional debug information.

Exceptions
• `poputil::poplibs_error`: If either `input` or `outputType` are not either half or float.

### popops/CircBuf.hpp¶

Circular buffer support.

namespace `popops`

Common functions, such as elementwise and reductions.

class `CircBuf`

Public Functions

`CircBuf`(poplar::Graph &graph, const poplar::Type &dataType, unsigned size, const std::vector<std::size_t> &shape, const poplar::DebugContext &debugContext = {})

CircBuf represents a circular buffer of tensors which can be indexed using prev().

Each call to `add()` will add the given tensor to the circular buffer with the potential to overwrite a previous element if the buffer is full.

Parameters
• `graph`: Graph to add the circular buffer to.

• `dataType`: Datatype of the tensor elements in buffer.

• `size`: Size of the circular buffer.

• `shape`: Shape of the tensor elements in buffer.

• `debugContext`: Optional debug information.

poplar::Tensor `prev`(unsigned i, poplar::program::Sequence &seq, const poplar::DebugContext &debugContext = {})

Return elements `i` entries old.

`i` must be less `size`.

Return

Tensor returned from the circular buffer.

Parameters
• `i`: Index into the circular buffer.

• `seq`: Program to add the operation to.

• `debugContext`: Optional debug information.

void `add`(poplar::Tensor t, poplar::program::Sequence &seq, const poplar::DebugContext &debugContext = {})

Append an element to the end of the circular buffer.

Parameters
• `t`: Tensor to append to the circular buffer

• `seq`: Program to add the operation to.

• `debugContext`: Optional debug information.

poplar::Tensor `getIndex`() const

Tensor representing the index into the circular buffer.

unsigned `size`() const

Size of the circular buffer.

poplar::Graph::TileToTensorMapping `getTileMapping`()

Return

Tensor mapping of the tensor returned by indexing into a circular buffer.

Private Members

poplar::Graph &`graph`
unsigned `size_`
poplar::Tensor `index`
std::vector<std::size_t> `shape`
unsigned `padElements`
poplar::Tensor `hist`

### popops/CollectiveTypes.hpp¶

Support types for replicated and non-replicated collectives.

namespace `popops`

Common functions, such as elementwise and reductions.

Enums

enum `CollectiveOperator`

Supported collective operators.

Values:

enumerator `ADD`
enumerator `MUL`
enumerator `MIN`
enumerator `MAX`
enumerator `LOGICAL_AND`

Only supports boolean operands.

enumerator `LOGICAL_OR`

Only supports boolean operands.

enumerator `SQUARE_ADD`

Squares each element before applying ADD reduction.

enumerator `LOCAL`

Do nothing and keep the local value.

enumerator `ADD`
enumerator `MEAN`
enumerator `MUL`
enumerator `MIN`
enumerator `MAX`
enumerator `LOGICAL_AND`

Only supports boolean operands.

enumerator `LOGICAL_OR`

Only supports boolean operands.

enumerator `SQUARE_ADD`

Squares each element before applying ADD reduction.

enumerator `LOCAL`

Do nothing and keep the local value.

struct `Chunk`
#include <Collectives.hpp>
struct `Chunks`
#include <Collectives.hpp>

### popops/DynamicSlice.hpp¶

Support for dynamic slices.

namespace `poplar`

Poplar classes and functions.

namespace `popops`

Common functions, such as elementwise and reductions.

Functions

bool `operator<`(const SlicePlan &a, const SlicePlan &b) noexcept
bool `operator==`(const SlicePlan &a, const SlicePlan &b) noexcept
bool `operator!=`(const SlicePlan &a, const SlicePlan &b) noexcept
poplar::Tensor `createSliceableTensor`(poplar::Graph &graph, const poplar::Type &type, const std::vector<size_t> &shape, const std::vector<size_t> &dims, const std::vector<size_t> &sizes, std::size_t minGrainSize = 0, const poplar::DebugContext &debugContext = {})

Create and map a tensor to be sliced/updated efficiently.

The returned tensor will be spread over as many tiles as possible while respecting the minimum number of elements per tile (`minGrainSize`) and still being in a form that can be sliced/updated efficiently.

Return

A tensor shape `shape` that is suitably mapped

Parameters
• `graph`: The Poplar graph.

• `type`: The type of the elements.

• `shape`: The shape of the tensor to be slice/updated.

• `dims`: The dimensions of the tensor that will be slice/updated.

• `sizes`: The size of the slice in each of the dimensions.

• `minGrainSize`: The minimum elements per slice mapped to each tile

• `debugContext`: Optional debug information.

poplar::Tensor `createSliceableTensor`(poplar::Graph &graph, const poplar::Type &type, const std::vector<size_t> &shape, const std::vector<size_t> &dims, const std::vector<size_t> &sizes, const SlicePlan &plan, const poplar::OptionFlags &options, const poplar::DebugContext &debugContext = {})

Create and map a tensor to be sliced/updated efficiently.

The returned tensor will be laid out according to the plan.

Return

A tensor shape `shape` that is suitably mapped.

Parameters
• `graph`: The Poplar graph.

• `type`: The type of the elements.

• `shape`: The shape of the tensor to be slice/updated.

• `dims`: The dimensions of the tensor that will be slice/updated.

• `sizes`: The size of the slice in each of the dimensions.

• `plan`: Plan describing how the slicing/updating operation will be implemented.

• `options`: Flags controlling how the operation will be implemented.

• `debugContext`: Optional debug information.

poplar::Tensor `createSliceTensor`(poplar::Graph &graph, const poplar::Tensor &t, const std::vector<size_t> &dims, const std::vector<size_t> &sizes, std::size_t numIndices, const poplar::DebugContext &debugContext = {})

Create and map a tensor to be sliced into or updated from efficiently.

Introspection on the tensor `t` is used to lay out the created tensor such that it can be used to efficiently update `t`.

Return

A tensor with shape [numIndices, shape…] mapped appropriately to be sliced into/updated from.

Parameters
• `graph`: The Poplar graph.

• `t`: The tensor to be updated.

• `dims`: The dimensions of the tensor that will be sliced/updated.

• `sizes`: The number of elements of each dimension in `dims` that will be sliced/updated.

• `numIndices`: The number of slices this tensor should contain.

• `plan`: Plan describing how the slicing/updating operation will be implemented.

• `options`: Flags controlling how the operation will be implemented.

• `debugContext`: Optional debug information.

poplar::Tensor `createSliceTensor`(poplar::Graph &graph, const poplar::Type &type, const std::vector<std::size_t> &shape, const std::vector<std::size_t> &dims, const std::vector<std::size_t> &sizes, std::size_t numIndices, const SlicePlan &plan, const poplar::OptionFlags &options, const poplar::DebugContext &debugContext = {})

Create and map a tensor to be sliced into or updated from efficiently.

The returned tensor is laid out according to the plan for the slice/update operation.

Return

A tensor with shape [numIndices, shape…] mapped appropriately to be sliced into/updated from.

Parameters
• `graph`: The Poplar graph.

• `type`: The type of the elements.

• `shape`: The shape of the tensor to be slice/updated.

• `dims`: The dimensions of the tensor that will be sliced/updated.

• `sizes`: The number of elements of each dimension in `dims` that will be sliced/updated.

• `numIndices`: The number of slices this tensor should contain.

• `plan`: Plan describing how the slicing/updating operation will be implemented.

• `options`: Flags controlling how the operation will be implemented.

• `debugContext`: Optional debug information.

poplar::Tensor `createIndicesTensor`(poplar::Graph &graph, const std::vector<std::size_t> &dims, std::size_t numIndices, const SlicePlan &plan, const poplar::OptionFlags &options, const poplar::DebugContext &debugContext = {})

Create and map a tensor to contain indices for slicing or updating a tensor efficiently.

Return

A tensor of shape [numIndices, dims.size()] mapped appropriately to be used as the indices for a slice/update operation. Element type is always UNSIGNED_INT.

Parameters
• `graph`: The Poplar graph.

• `dims`: The dimensions of a tensor to be sliced/updated that will be sliced/updated using these indices.

• `numIndices`: The number of indices this tensor should contain

• `plan`: Plan describing how the slicing/updating operation will be implemented.

• `options`: Flags controlling how the operation will be implemented.

• `debugContext`: Optional debug information.

poplar::Tensor `createSliceableTensorFromSlice`(poplar::Graph &graph, const poplar::Tensor &s, const std::vector<std::size_t> &dims, const std::vector<std::size_t> &numSlices, const poplar::DebugContext &debugContext = {})

Create and map a tensor to be sliced/updated.

The tensor is mapped in a way that can be efficiently sliced and updated to/from the given slice tensor. It will be distributed across as many tiles as the given slice and with the same contiguous regions on each tile. The tensor’s shape and mapping are derived from the reference slice tensor.

Return

A tensor to be sliced/updated.

Parameters
• `graph`: The Poplar graph.

• `s`: The reference slice.

• `dims`: The dimensions of the returned tensor that will be sliced.

• `numSlices`: The number of independent slices in each sliced dimension.

• `debugContext`: Optional debug information.

poplar::Tensor `dynamicSlice`(poplar::Graph &graph, const poplar::Tensor &t, const poplar::Tensor &offset, const std::vector<std::size_t> &dims, const std::vector<std::size_t> &sizes, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {})

Slice a tensor based on offsets specified by a tensor.

`dims` gives the dimensions to slice, `sizes` defines the size of the slice in those dimensions and `offset` gives the base offsets on each execution.

`offset`[0], `dims` and `sizes` must have the same size. `offset` may have a second dimension with an element per tile, which can eliminate exchange.

Return

The specified subtensor

Parameters
• `graph`: The Poplar graph.

• `t`: The source tensor.

• `offset`: A tensor of offsets at which the output is extracted.

• `dims`: The dimensions of `t` to slice.

• `sizes`: The size of the slice in each of the dimensions in `dims`.

• `prog`: The program to be extended

• `debugContext`: Optional debug information.

poplar::Graph::TileToTensorMapping `getSliceMapping`(poplar::Graph &graph, const poplar::Tensor &t, const std::vector<std::size_t> &dims, const std::vector<std::size_t> &sizes)

Get the tile mapping for a slice of a tensor.

`dims` gives the dimensions to slice, `sizes` defines the size of the slice in those dimensions.

Parameters
• `graph`: The Poplar graph.

• `t`: The source tensor.

• `dims`: The dimensions of `t` to slice.

• `sizes`: The size of the slice in each of the dimensions in `dims`.

void `dynamicUpdate`(poplar::Graph &graph, const poplar::Tensor &t, const poplar::Tensor &s, const poplar::Tensor &offset, const std::vector<std::size_t> &dims, const std::vector<std::size_t> &sizes, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {})

Update a subtensor at offsets read from a tensor.

`dims` gives the dimensions that are partially updated, by `sizes` elements, at offsets `offset`. Unspecified dimensions are copied in full with zero offset.

`offset`[0], `dims` and `sizes` must have the same size. `offset` may have a second dimension with an element per tile, which can eliminate exchange.

Parameters
• `graph`: The Poplar graph.

• `t`: The tensor to update.

• `s`: The updates.

• `offset`: The offset within `t` to be updated.

• `dims`: The dimensions to be dynamically updated.

• `sizes`: The size of the update in each of the dimensions in `dims`.

• `prog`: The program to be extended.

• `debugContext`: Optional debug information.

poplar::Tensor `multiSlice`(poplar::Graph &graph, const poplar::Tensor &t, const poplar::Tensor &offsets, const std::vector<std::size_t> &dims, const std::vector<std::size_t> &sizes, poplar::program::Sequence &prog, const SlicePlan &plan, const poplar::OptionFlags &options, const poplar::DebugContext &debugContext = {})

Take multiple slices from a base tensor.

The returned tensor will have a rank one greater than `t`. Its outer dimension will be `offsets.dim(0)`. Note that `dims` refers to the dimensions of `t`. `t` can be created using `createSliceableTensor()` to ensure efficient mapping.

Parameters
• `graph`: The Poplar graph.

• `t`: The tensor being sliced.

• `offsets`: The offsets within `t` to be sliced.

• `dims`: The dimensions of `t` to be sliced.

• `sizes`: The size of the update in each of the dimensions in `dims`.

• `prog`: The program to be extended.

• `plan`: Plan describing how the operation will be implemented.

• `options`: Flags controlling how the operation will be implemented.

• `debugContext`: Optional debug information.

void `multiUpdate`(poplar::Graph &graph, const poplar::Tensor &t, const poplar::Tensor &s, const poplar::Tensor &offsets, const std::vector<std::size_t> &dims, const std::vector<std::size_t> &sizes, poplar::program::Sequence &prog, const SlicePlan &plan, const poplar::OptionFlags &options, const poplar::DebugContext &debugContext = {})

Update multiple slices in a tensor.

Parameters
• `graph`: The Poplar graph.

• `t`: The tensor being updated.

• `s`: The slices to insert.

• `offsets`: The offsets within `t` to be updated.

• `dims`: The dimensions of `t` to be updated.

• `sizes`: The size of the update in each of the dimensions in `dims`.

• `prog`: The program to be extended.

• `plan`: Plan describing how the operation will be implemented.

• `options`: Flags controlling how the operation will be implemented.

• `debugContext`: Optional debug information.

void `multiUpdateAdd`(poplar::Graph &graph, const poplar::Tensor &t, const poplar::Tensor &s, const poplar::Tensor &offsets, const poplar::Tensor &scale, const std::vector<std::size_t> &dims, const std::vector<std::size_t> &sizes, poplar::program::Sequence &prog, const SlicePlan &plan, const poplar::OptionFlags &options, const poplar::DebugContext &debugContext = {})

Accumulate multiple slices in a tensor for i offsets: t[offsets[i]] += scale * s[i] `t`, `s` and `scale` must have the same element type.

Parameters
• `graph`: The Poplar graph.

• `t`: The tensor being updated (must be rank 2).

• `s`: The slices to accumulate.

• `offsets`: The offsets within `t` to be accumulated.

• `scale`: The scaling to apply to the update.

• `dims`: The dimensions of `t` to be accumulated (must be rank 1).

• `sizes`: The size of the accumulate in each of the dimensions in `dims`.

• `prog`: The program to be extended.

• `plan`: Plan describing how the operation will be implemented.

• `options`: Flags controlling how the operation will be implemented.

• `debugContext`: Optional debug information.

void `multiUpdateMax`(poplar::Graph &graph, const poplar::Tensor &t, const poplar::Tensor &s, const poplar::Tensor &offsets, const std::vector<std::size_t> &dims, const std::vector<std::size_t> &sizes, poplar::program::Sequence &prog, const SlicePlan &plan, const poplar::OptionFlags &options, const poplar::DebugContext &debugContext = {})

Find maximum over multiple slices in a tensor for i offsets: t[offsets[i]] = max(t[offsets[i]], s[i]) `t`, `s` must have the same element type offsets[i] >= t.dim(0) are ignored.

Parameters
• `graph`: The Poplar graph.

• `t`: The tensor being updated (must be rank 2).

• `s`: The slices to find maximum over.

• `offsets`: The offsets within `t` to find maximum over.

• `dims`: The dimensions of `t` to find maximum over (must be rank 1).

• `sizes`: The size of the update in each of the dimensions in `dims`.

• `prog`: The program to be extended.

• `plan`: Plan describing how the operation will be implemented.

• `options`: Flags controlling how the operation will be implemented.

• `debugContext`: Optional debug information.

class `SlicePlan`
#include <DynamicSlice.hpp>

An object representing a plan that describes how to implement a slice or update.

This can be used as a parameter to a function that will slice or update a tensor.

Public Functions

`SlicePlan`()
`~SlicePlan`()
`SlicePlan`(const SlicePlan &other)
`SlicePlan`(SlicePlan &&other)
SlicePlan &`operator=`(const SlicePlan &other)
SlicePlan &`operator=`(SlicePlan &&other)
`SlicePlan`(std::unique_ptr<SlicePlanInternal> internal)
SlicePlanInternal &`getImpl`() const

Private Members

std::unique_ptr<SlicePlanInternal> `internal`

Friends

`friend friend std::ostream & operator<< (std::ostream &o, const SlicePlan &p)`
`friend friend bool operator< (const SlicePlan &a, const SlicePlan &b) noexcept`
`friend friend bool operator== (const SlicePlan &a, const SlicePlan &b) noexcept`
`friend friend poplar::ProfileValue poputil::toProfileValue (const SlicePlan &p)`
namespace `embedding`

Functions

SlicePlan `plan`(const poplar::Graph &graph, const poplar::Type &dataType, const std::size_t numEntries, const std::size_t outputSize, const std::vector<std::size_t> &numLookups, const poplar::OptionFlags &options)

Create a plan for implementing a set of operations on an embedding matrix.

** Embedding plan options **

• `usedForUpdate` (true, false) [=true]

If true, you intend to use this embedding plan for both a multiSlice and multiUpdate* operation and the plan returned accounts for the costs of both operations. If false, only the costs of a multiSlice are accounted for.

• `availableMemoryProportion` Positive decimal

If set, gives the proportion of tile memory made available for temporary variables (variables that become live and die during the operation) for this operation. If not set, the operation has the freedom to use unlimited temporary memory.

• `indicesDistribution` (uniform, onePoint) [=uniform]

A description of the statistical distribution of the indices that will be sliced/updated over the input size (`numEntries`) of the operation. This is used to when estimating the runtime of the multiSlice and multiUpdate* operation.

• `uniform` Indices are assumed to be uniformly distributed over the input size of the embedding.

• `onePoint` Indices are assumed to all be equal.

• `planMinimisationTarget` (memory, cycles) [=memory]

Select what should be minimised when planning this operation.

• `memory` Minimise a weighted combination of estimated maximum tile memory needed for code, for input/indices/output operands, and temporary variables for the operation.

• `cycles` Minimise estimated total cycles for the operation.

Return

A plan which describes how the embedding matrix lookup/update operations should be implemented.

Parameters
• `graph`: The graph the operation will be added to.

• `dataType`: The data type of the entries in the embedding matrix and the resulting lookups from the matrix.

• `numEntries`: Input size of embedding matrix.

• `outputSize`: Output size of embedding matrix lookup.

• `numLookups`: Vector of numbers of indices which will be looked up in the embedding matrix.

• `options`: Set of option flags controlling how the operation will be implemented.

### popops/ElementWise.hpp¶

These functions perform the same operation on each element of one or more tensors.

Every function has an in-place overload that writes the result of the function to the first tensor argument of the function.

The functions that perform operations on two tensors also have overloads for one of the tensors being a constant scalar. These functions perform the same operation on each element in the remaining tensor using the scalar as the other side of the operation for all elements.

namespace `poputil`

General utility functions for building graphs.

Functions

template<>
poplar::ProfileValue `toProfileValue`(const popops::expr::UnaryOpType &op)
template<>
poplar::ProfileValue `toProfileValue`(const popops::expr::BinaryOpType &op)
template<>
poplar::ProfileValue `toProfileValue`(const popops::expr::TernaryOpType &op)
namespace `popops`

Common functions, such as elementwise and reductions.

Unnamed Group

poplar::Tensor `varianceToInvStdDev`(poplar::Graph &graph, const poplar::Tensor &src, const poplar::Tensor &epsilon, poplar::program::Sequence &prog, const poplar::Type dstType = poplar::HALF, const poplar::DebugContext &debugContext = {})

Convert variance to inverse standard deviation.

Return

A tensor where each element is the inverse of standard deviation. Each element is the result of `b = sqrt(1 / a)`, where `a` and `b` are the corresponding elements of `src` and the result tensor respectively.

Parameters
• `graph`: The graph to update.

• `src`: The source tensor.

• `epsilon`: A tensor initialised with the epsilon parameter used in conversion. Must have a single element and have the same type as the input type. Alternatively a float value can be used and the appropriate tensor will be created.

• `prog`: The sequence to extend with the execution of conversion.

• `dstType`: The type of the tensor to be output. Must be `HALF` or equal to the input type.

• `debugContext`: Optional debug information

poplar::Tensor `varianceToInvStdDev`(poplar::Graph &graph, const poplar::Tensor &src, const float epsilon, poplar::program::Sequence &prog, const poplar::Type dstType = poplar::HALF, const poplar::DebugContext &debugContext = {})

Unnamed Group

poplar::Tensor `invStdDevToVariance`(poplar::Graph &graph, const poplar::Tensor &src, const poplar::Tensor &epsilon, poplar::program::Sequence &prog, const poplar::Type dstType = poplar::FLOAT, const poplar::DebugContext &debugContext = {})

Convert inverse standard deviation to variance.

Return

A tensor where each element is the variance. Each element is the result of `b = (1 / a) ^ 2`, where `a` and `b` are the corresponding elements of `src` and the result tensor respectively.

Parameters
• `graph`: The graph to update.

• `src`: The source tensor.

• `epsilon`: A tensor initialised with the epsilon parameter used in conversion. Must have a single element and have the same type as the input type. Alternatively, a float value can be used and the appropriate tensor will be created.

• `prog`: The sequence to extend with the execution of conversion.

• `dstType`: The type of the tensor to be output. Must be `FLOAT` or equal to the input type.

• `debugContext`: Optional debug information

poplar::Tensor `invStdDevToVariance`(poplar::Graph &graph, const poplar::Tensor &src, const float epsilon, poplar::program::Sequence &prog, const poplar::Type dstType = poplar::FLOAT, const poplar::DebugContext &debugContext = {})

Unnamed Group

poplar::Tensor `map`(poplar::Graph &graph, const expr::Expr &expr, const std::vector<poplar::Tensor> &ts, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Map an expression across tensors.

Element Wise Options

• `enableGenerateCodelet` (true, false) [=true]

If true (and all of the inputs are the same size and do not alias), a codelet is generated to execute this map operation. A codelet will not be generated if there is only a single operation unless `forceGenerateCodelet` is true.

Return

A tensor containing the elements resulting from the application of the expression across the tensors.

Parameters
• `graph`: The graph to update.

• `expr`: The expression to map across the tensors. The placeholders in the expressions will be substituted with corresponding elements from the tensors in `ts`.

• `ts`: The list of tensors to map the expression across. If elements from these tensors are used in binary/ternary operations in the expression the numpy-style broadcast rules are used to match the shapes of the tensors (see poputil::broadcastToMatch()).

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information

• `options`: A list of flags to pass to the expression evaluator.

poplar::Tensor `map`(poplar::Graph &graph, expr::UnaryOpType op, const poplar::Tensor &t, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})
poplar::Tensor `map`(poplar::Graph &graph, expr::BinaryOpType op, const poplar::Tensor &a, const poplar::Tensor &b, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})
poplar::Tensor `map`(poplar::Graph &graph, expr::TernaryOpType op, const poplar::Tensor &a, const poplar::Tensor &b, const poplar::Tensor &c, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

void `mapInPlace`(poplar::Graph &graph, const expr::Expr &expr, const std::vector<poplar::Tensor> &ts, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

void `mapInPlace`(poplar::Graph &graph, expr::UnaryOpType op, const poplar::Tensor &t, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})
void `mapInPlace`(poplar::Graph &graph, expr::BinaryOpType op, const poplar::Tensor &a, const poplar::Tensor &b, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})
void `mapInPlace`(poplar::Graph &graph, expr::TernaryOpType op, const poplar::Tensor &a, const poplar::Tensor &b, const poplar::Tensor &c, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

poplar::Tensor `abs`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Compute the absolute value of each element in `A`.

Return

A tensor where each element is equivalent to the result of `std::abs(a)`, where `a` is an element of `A`.

Parameters
• `graph`: The graph to update.

• `A`: A tensor of elements.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information

• `options`: Element-wise options. See map().

void `absInPlace`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Update the input tensor with the result of abs().

Unnamed Group

template<typename `constType`>
void `checkTypes`(poplar::Type elementType, constType constant)

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

Parameters
• `elementType`: The run-time IPU type.

• `constant`: Unused.

Template Parameters
• `constType`: The host compile-time type.

Exceptions
• `std::runtime_error`: If the types are not compatible.

template<>
void `checkTypes`<float>(poplar::Type elementType, float constant)
template<>
void `checkTypes`<double>(poplar::Type elementType, double constant)

Unnamed Group

poplar::Tensor `add`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

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.

Parameters
• `graph`: The graph to update.

• `A`: A tensor of elements.

• `B`: A tensor of elements.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information

• `options`: Element-wise options. See map().

template<typename `constType`>
poplar::Tensor `add`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})
template<typename `constType`>
poplar::Tensor `add`(poplar::Graph &graph, const constType A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

void `addInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

template<typename `constType`>
void `addInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

poplar::Tensor `atan2`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Compute the two argument arctangent of each element in `A` with the corresponding element in `B`.

Return

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

Parameters
• `graph`: The graph to update.

• `A`: A tensor of elements.

• `B`: A tensor of elements.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information

• `options`: Element-wise options. See map().

template<typename `constType`>
poplar::Tensor `atan2`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})
template<typename `constType`>
poplar::Tensor `atan2`(poplar::Graph &graph, const constType A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

void `atan2InPlace`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

template<typename `constType`>
void `atan2InPlace`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

poplar::Tensor `bitwiseAnd`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

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.

Parameters
• `graph`: The graph to update.

• `A`: A tensor of elements.

• `B`: A tensor of elements.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information

• `options`: Element-wise options. See map().

template<typename `constType`>
poplar::Tensor `bitwiseAnd`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})
template<typename `constType`>
poplar::Tensor `bitwiseAnd`(poplar::Graph &graph, const constType A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

void `bitwiseAndInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

template<typename `constType`>
void `bitwiseAndInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

poplar::Tensor `bitwiseOr`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

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.

Parameters
• `graph`: The graph to update.

• `A`: A tensor of elements.

• `B`: A tensor of elements.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information

• `options`: Element-wise options. See map().

template<typename `constType`>
poplar::Tensor `bitwiseOr`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})
template<typename `constType`>
poplar::Tensor `bitwiseOr`(poplar::Graph &graph, const constType A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

void `bitwiseOrInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

template<typename `constType`>
void `bitwiseOrInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

poplar::Tensor `bitwiseXor`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

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.

Parameters
• `graph`: The graph to update.

• `A`: A tensor of elements.

• `B`: A tensor of elements.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information

• `options`: Element-wise options. See map().

template<typename `constType`>
poplar::Tensor `bitwiseXor`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})
template<typename `constType`>
poplar::Tensor `bitwiseXor`(poplar::Graph &graph, const constType A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

void `bitwiseXorInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

template<typename `constType`>
void `bitwiseXorInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

poplar::Tensor `bitwiseXnor`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

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.

Parameters
• `graph`: The graph to update.

• `A`: A tensor of elements.

• `B`: A tensor of elements.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information

• `options`: Element-wise options. See map().

template<typename `constType`>
poplar::Tensor `bitwiseXnor`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})
template<typename `constType`>
poplar::Tensor `bitwiseXnor`(poplar::Graph &graph, const constType A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

void `bitwiseXnorInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

template<typename `constType`>
void `bitwiseXnorInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

poplar::Tensor `div`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

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.

Parameters
• `graph`: The graph to update.

• `A`: The tensor of dividends.

• `B`: The tensor of divisors.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information

• `options`: Element-wise options. See map().

template<typename `constType`>
poplar::Tensor `div`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})
template<typename `constType`>
poplar::Tensor `div`(poplar::Graph &graph, const constType A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

void `divInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

template<typename `constType`>
void `divInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

poplar::Tensor `eq`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

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.

Parameters
• `graph`: The graph to update.

• `A`: A tensor of elements.

• `B`: A tensor of elements.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information

• `options`: Element-wise options. See map().

template<typename `constType`>
poplar::Tensor `eq`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})
template<typename `constType`>
poplar::Tensor `eq`(poplar::Graph &graph, const constType A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

void `eqInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

template<typename `constType`>
void `eqInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

poplar::Tensor `gteq`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

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.

Parameters
• `graph`: The graph to update.

• `A`: A tensor of elements.

• `B`: A tensor of elements.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information

• `options`: Element-wise options. See map().

template<typename `constType`>
poplar::Tensor `gteq`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})
template<typename `constType`>
poplar::Tensor `gteq`(poplar::Graph &graph, const constType A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

void `gteqInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

template<typename `constType`>
void `gteqInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

poplar::Tensor `gt`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

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.

Parameters
• `graph`: The graph to update.

• `A`: A tensor of elements.

• `B`: A tensor of elements.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information

• `options`: Element-wise options. See map().

template<typename `constType`>
poplar::Tensor `gt`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})
template<typename `constType`>
poplar::Tensor `gt`(poplar::Graph &graph, const constType A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

void `gtInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

template<typename `constType`>
void `gtInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

poplar::Tensor `invStdDevToVariance`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Convert the inverse standard deviation to variance.

Return

A tensor where each element is the variance. Each element is the result of `b = (1 / a) ^ 2`, where `a` and `b` are the corresponding elements of `A` and `B` tensors respectively, and where `A` represents the inverse standard deviation and `B` the variance.

Parameters
• `graph`: The graph to update.

• `A`: The source tensor.

• `B`: The destination tensor.

• `prog`: The sequence to extend with the execution of conversion.

• `debugContext`: Optional debug information.

• `options`: A list of flags to pass to the expression evaluator.

template<typename `constType`>
poplar::Tensor `invStdDevToVariance`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})
template<typename `constType`>
poplar::Tensor `invStdDevToVariance`(poplar::Graph &graph, const constType A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

void `invStdDevToVarianceInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

template<typename `constType`>
void `invStdDevToVarianceInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

poplar::Tensor `lteq`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

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.

Parameters
• `graph`: The graph to update.

• `A`: A tensor of elements.

• `B`: A tensor of elements.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information.

• `options`: Element-wise options. See map().

template<typename `constType`>
poplar::Tensor `lteq`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})
template<typename `constType`>
poplar::Tensor `lteq`(poplar::Graph &graph, const constType A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

void `lteqInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Update the input tensor with the result of lteq().

template<typename `constType`>
void `lteqInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

poplar::Tensor `logicalAnd`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

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.

Parameters
• `graph`: The graph to update.

• `A`: A tensor of elements.

• `B`: A tensor of elements.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information.

• `options`: Element-wise options. See map().

template<typename `constType`>
poplar::Tensor `logicalAnd`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})
template<typename `constType`>
poplar::Tensor `logicalAnd`(poplar::Graph &graph, const constType A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

void `logicalAndInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

template<typename `constType`>
void `logicalAndInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

poplar::Tensor `logicalOr`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

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.

Parameters
• `graph`: The graph to update.

• `A`: A tensor of elements.

• `B`: A tensor of elements.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information.

• `options`: Element-wise options. See map().

template<typename `constType`>
poplar::Tensor `logicalOr`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})
template<typename `constType`>
poplar::Tensor `logicalOr`(poplar::Graph &graph, const constType A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

void `logicalOrInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

template<typename `constType`>
void `logicalOrInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

poplar::Tensor `lt`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

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.

Parameters
• `graph`: The graph to update.

• `A`: A tensor of elements.

• `B`: A tensor of elements.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information.

• `options`: Element-wise options. See map().

template<typename `constType`>
poplar::Tensor `lt`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})
template<typename `constType`>
poplar::Tensor `lt`(poplar::Graph &graph, const constType A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

void `ltInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Update the input tensor with the result of lt().

template<typename `constType`>
void `ltInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

poplar::Tensor `max`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

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.

Parameters
• `graph`: The graph to update.

• `A`: A tensor of elements.

• `B`: A tensor of elements.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information.

• `options`: Element-wise options. See map().

template<typename `constType`>
poplar::Tensor `max`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})
template<typename `constType`>
poplar::Tensor `max`(poplar::Graph &graph, const constType A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

void `maxInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

template<typename `constType`>
void `maxInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

poplar::Tensor `min`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

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.

Parameters
• `graph`: The graph to update.

• `A`: A tensor of elements.

• `B`: A tensor of elements.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information.

• `options`: Element-wise options. See map().

template<typename `constType`>
poplar::Tensor `min`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})
template<typename `constType`>
poplar::Tensor `min`(poplar::Graph &graph, const constType A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

void `minInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

template<typename `constType`>
void `minInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

poplar::Tensor `mul`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

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.

Parameters
• `graph`: The graph to update.

• `A`: A tensor of elements.

• `B`: A tensor of elements.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information.

• `options`: Element-wise options. See map().

template<typename `constType`>
poplar::Tensor `mul`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})
template<typename `constType`>
poplar::Tensor `mul`(poplar::Graph &graph, const constType A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

void `mulInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

template<typename `constType`>
void `mulInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

poplar::Tensor `neq`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

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.

Parameters
• `graph`: The graph to update.

• `A`: A tensor of elements.

• `B`: A tensor of elements.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information.

• `options`: Element-wise options. See map().

template<typename `constType`>
poplar::Tensor `neq`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})
template<typename `constType`>
poplar::Tensor `neq`(poplar::Graph &graph, const constType A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

void `neqInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

template<typename `constType`>
void `neqInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

poplar::Tensor `pow`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

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.

Parameters
• `graph`: The graph to update.

• `A`: The tensor of bases.

• `B`: The tensor of exponents.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information.

• `options`: Element-wise options. See map().

template<typename `constType`>
poplar::Tensor `pow`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})
template<typename `constType`>
poplar::Tensor `pow`(poplar::Graph &graph, const constType A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

void `powInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

template<typename `constType`>
void `powInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

poplar::Tensor `rem`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

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.

Parameters
• `graph`: The graph to update.

• `A`: The tensor of dividends.

• `B`: The tensor of divisors.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information.

• `options`: Element-wise options. See map().

template<typename `constType`>
poplar::Tensor `rem`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})
template<typename `constType`>
poplar::Tensor `rem`(poplar::Graph &graph, const constType A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

void `remInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

template<typename `constType`>
void `remInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

poplar::Tensor `shiftLeft`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

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.

Parameters
• `graph`: The graph to update.

• `A`: The tensor of elements which to left-shift.

• `B`: The tensor of elements that describe the amount to left-shift `A` by.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information.

• `options`: Element-wise options. See map().

template<typename `constType`>
poplar::Tensor `shiftLeft`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})
template<typename `constType`>
poplar::Tensor `shiftLeft`(poplar::Graph &graph, const constType A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

void `shiftLeftInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

template<typename `constType`>
void `shiftLeftInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

poplar::Tensor `shiftRight`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

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.

Parameters
• `graph`: The graph to update.

• `A`: The tensor of elements which to right-shift.

• `B`: The tensor of elements that describe the amount to right-shift by. `A`.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information.

• `options`: Element-wise options. See map().

template<typename `constType`>
poplar::Tensor `shiftRight`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})
template<typename `constType`>
poplar::Tensor `shiftRight`(poplar::Graph &graph, const constType A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

void `shiftRightInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

template<typename `constType`>
void `shiftRightInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

poplar::Tensor `shiftRightSignExtend`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

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.

Parameters
• `graph`: The graph to update.

• `A`: The tensor of elements which to right-shift.

• `B`: The tensor of elements that describe the amount to right-shift `A` by.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information.

• `options`: Element-wise options. See map().

template<typename `constType`>
poplar::Tensor `shiftRightSignExtend`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})
template<typename `constType`>
poplar::Tensor `shiftRightSignExtend`(poplar::Graph &graph, const constType A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

void `shiftRightSignExtendInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

template<typename `constType`>
void `shiftRightSignExtendInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

poplar::Tensor `sub`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

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.

Parameters
• `graph`: The graph to update.

• `A`: The tensor of elements which will be subtracted from.

• `B`: The tensor of elements to subtract from `A`.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information.

• `options`: Element-wise options. See map().

template<typename `constType`>
poplar::Tensor `sub`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})
template<typename `constType`>
poplar::Tensor `sub`(poplar::Graph &graph, const constType A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

void `subInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

template<typename `constType`>
void `subInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

poplar::Tensor `varianceToInvStdDev`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Convert variance to inverse standard deviation.

Return

A tensor where each element is the inverse of standard deviation. Each element is the result of `b = sqrt(1 / a)`, where `a` and `b` are the corresponding elements of `A` and `B` tensors respectively, and where `A` represents the variance and `B` the inverse standard deviation.

Parameters
• `graph`: The graph to update.

• `A`: The source tensor.

• `B`: The destination tensor.

• `prog`: The sequence to extend with the execution of conversion.

• `debugContext`: Optional debug information.

template<typename `constType`>
poplar::Tensor `varianceToInvStdDev`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})
template<typename `constType`>
poplar::Tensor `varianceToInvStdDev`(poplar::Graph &graph, const constType A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Unnamed Group

void `varianceToInvStdDevInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const poplar::Tensor &B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

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

template<typename `constType`>
void `varianceToInvStdDevInPlace`(poplar::Graph &graph, const poplar::Tensor &A, const constType B, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Functions

poplar::Tensor `asin`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Compute the arc-sine of each element in `A`.

Return

A tensor where each element is equivalent to the result of `std::asin(a)`, where `a` is an element of `A`.

Parameters
• `graph`: The graph to update.

• `A`: A tensor of elements.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information

• `options`: Element-wise options. See map().

void `asinInPlace`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Update the input tensor with the result of asin().

poplar::Tensor `bitwiseNot`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Compute the bitwise NOT operation for each element in `A`.

Return

A tensor where each element is equivalent to the result of `~a`, where `a` is an element of `A`.

Parameters
• `graph`: The graph to update.

• `A`: A tensor of elements.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information

• `options`: Element-wise options. See map().

void `bitwiseNotInPlace`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Update the input tensor with the result of bitwiseNot().

poplar::Tensor `cbrt`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Compute the cube-root for each element in `A`.

Return

A tensor where each element is equivalent to the result of `std::cbrt(a)`, where `a` is an element of `A`.

Parameters
• `graph`: The graph to update.

• `A`: A tensor of elements.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information

• `options`: Element-wise options. See map().

void `cbrtInPlace`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Update the input tensor with the result of cbrt().

poplar::Tensor `ceil`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Compute the ceiling of each element in `A`.

Return

A tensor where each element is equivalent to the result of `std::ceil(a)`, where `a` is an element of `A`.

Parameters
• `graph`: The graph to update.

• `A`: A tensor of elements.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information

• `options`: Element-wise options. See map().

void `ceilInPlace`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Update the input tensor with the result of ceil().

poplar::Tensor `countLeadingZeros`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Compute the number of binary leading zeros of each element in `A`.

Note

If the element is zero then it is treated as 32 leading zeros.

Return

A tensor where each element is equivalent to the result of `a ? __builtin_clz(a) : 32`, where `a` is an element of `A`.

Parameters
• `graph`: The graph to update.

• `A`: A tensor of elements.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information

• `options`: Element-wise options. See map().

void `countLeadingZerosInPlace`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Update the input tensor with the result of countLeadingZeros().

poplar::Tensor `cos`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Compute the cosine of each element in `A`.

Return

A tensor where each element is equivalent to the result of `std::cos(a)`, where `a` is an element of `A`.

Parameters
• `graph`: The graph to update.

• `A`: A tensor of elements.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information

• `options`: Element-wise options. See map().

void `cosInPlace`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Update the input tensor with the result of cos().

poplar::Tensor `erf`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Compute the error function of each element in `A`.

Return

A tensor where each element is equivalent to the result of `std::erf(a)`, where `a` is an element of `A`.

Parameters
• `graph`: The graph to update.

• `A`: A tensor of elements.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information

• `options`: Element-wise options. See map().

void `erfInPlace`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Update the input tensor with the result of erf().

poplar::Tensor `exp`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Compute the exponential of each element in `A`.

Return

A tensor where each element is equivalent to the result of `std::exp(a)`, where `a` is an element of `A`.

Parameters
• `graph`: The graph to update.

• `A`: A tensor of elements.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information

• `options`: Element-wise options. See map().

void `expInPlace`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Update the input tensor with the result of exp().

poplar::Tensor `expm1`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Compute the exponential of each element in `A` minus one.

Return

A tensor where each element is equivalent to the result of `std::expm1(a)`, where `a` is an element of `A`.

Parameters
• `graph`: The graph to update.

• `A`: A tensor of elements.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information

• `options`: Element-wise options. See map().

void `expm1InPlace`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Update the input tensor with the result of expm1().

poplar::Tensor `floor`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Compute the floor of each element in `A`.

Return

A tensor where each element is equivalent to the result of `std::floor(a)`, where `a` is an element of `A`.

Parameters
• `graph`: The graph to update.

• `A`: A tensor of elements.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information

• `options`: Element-wise options. See map().

void `floorInPlace`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Update the input tensor with the result of floor().

poplar::Tensor `inv`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Compute the inverse of each element in `A`.

Return

A tensor where each element is equivalent to the result of `1 / a`, where `a` is an element of `A`.

Parameters
• `graph`: The graph to update.

• `A`: A tensor of elements.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information

• `options`: Element-wise options. See map().

void `invInPlace`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Update the input tensor with the result of inv().

poplar::Tensor `log`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Compute the log base-e of each element in `A`.

Return

A tensor where each element is equivalent to the result of `std::log(a)`, where `a` is an element of `A`.

Parameters
• `graph`: The graph to update.

• `A`: A tensor of elements.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information

• `options`: Element-wise options. See map().

void `logInPlace`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Update the input tensor with the result of log().

poplar::Tensor `log1p`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Compute the log base-e of each element in `A` plus one.

Return

A tensor where each element is equivalent to the result of `std::log1p(a)`, where `a` is an element of `A`.

Parameters
• `graph`: The graph to update.

• `A`: A tensor of elements.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information

• `options`: Element-wise options. See map().

void `log1pInPlace`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Update the input tensor with the result of log1p().

poplar::Tensor `logicalNot`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Compute the logical NOT of each element in `A`.

Return

A tensor where each element is equivalent to the result of `!a`, where `a` is an element of `A`.

Parameters
• `graph`: The graph to update.

• `A`: A tensor of elements.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information

• `options`: Element-wise options. See map().

void `logicalNotInPlace`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Update the input tensor with the result of logicalNot().

poplar::Tensor `neg`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Compute the negation of each element in `A`.

Return

A tensor where each element is equivalent to the result of `-1 * a`, where `a` is an element of `A`.

Parameters
• `graph`: The graph to update.

• `A`: A tensor of elements.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information

• `options`: Element-wise options. See map().

void `negInPlace`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Update the input tensor with the result of neg().

poplar::Tensor `popcount`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Compute the number of 1 bits in each element of `A`.

Return

A tensor where each element is equivalent to the result of `std::popcount(a)`, where `a` is an element of `A`.

Parameters
• `graph`: The graph to update.

• `A`: A tensor of elements.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information

• `options`: Element-wise options. See map().

void `popcountInPlace`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Update the input tensor with the result of popcount().

poplar::Tensor `signum`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Compute the signum of each element in `A`.

Return

A tensor where each element is one of -1, 0 or +1 if the corresponding element in `A` was less than, equal to or greater than 0 respectively.

Parameters
• `graph`: The graph to update.

• `A`: A tensor of elements.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information

• `options`: Element-wise options. See map().

void `signumInPlace`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Update the input tensor with the result of signum().

poplar::Tensor `sin`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Compute the sine of each element in `A`.

Return

A tensor where each element is equivalent to the result of `std::sin(a)`, where `a` is an element of `A`.

Parameters
• `graph`: The graph to update.

• `A`: A tensor of elements.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information

• `options`: Element-wise options. See map().

void `sinInPlace`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Update the input tensor with the result of sin().

poplar::Tensor `tan`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Compute the tangent of each element in `A`.

Return

A tensor where each element is equivalent to the result of `std::tan(a)`, where `a` is an element of `A`.

Parameters
• `graph`: The graph to update.

• `A`: A tensor of elements.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information

• `options`: Element-wise options. See map().

void `tanInPlace`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Update the input tensor with the result of tan().

poplar::Tensor `tanh`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Compute the hyperbolic tangent of each element in `A`.

Return

A tensor where each element is equivalent to the result of `std::tanh(a)`, where `a` is an element of `A`.

Parameters
• `graph`: The graph to update.

• `A`: A tensor of elements.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information

• `options`: Element-wise options. See map().

void `tanhInPlace`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Update the input tensor with the result of tanh().

poplar::Tensor `round`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Round each element in `A`.

Return

A tensor where each element is equivalent to the result of `std::round(a)`, where `a` is an element of `A`.

Parameters
• `graph`: The graph to update.

• `A`: A tensor of elements.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information

• `options`: Element-wise options. See map().

void `roundInPlace`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Update the input tensor with the result of round().

poplar::Tensor `sqrt`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Compute the square-root for each element in `A`.

Return

A tensor where each element is equivalent to the result of `std::sqrt(a)`, where `a` is an element of `A`.

Parameters
• `graph`: The graph to update.

• `A`: A tensor of elements.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information

• `options`: Element-wise options. See map().

void `sqrtInPlace`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Update the input tensor with the result of sqrt().

poplar::Tensor `square`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Compute the square for each element in `A`.

Return

A tensor where each element is equivalent to the result of `x * x`, where `a` is an element of `A`.

Parameters
• `graph`: The graph to update.

• `A`: A tensor of elements.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information

• `options`: Element-wise options. See map().

void `squareInPlace`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Update the input tensor with the result of square().

poplar::Tensor `sigmoid`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Compute the sigmoid (logistic) function for each element in `A`.

Return

A tensor where each element is equivalent to the result of `1 / (1 + exp(-x))`, where `a` is an element of `A`.

Parameters
• `graph`: The graph to update.

• `A`: A tensor of elements.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information

• `options`: Element-wise options. See map().

void `sigmoidInPlace`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Update the input tensor with the result of sigmoid().

poplar::Tensor `rsqrt`(poplar::Graph &graph, const poplar::Tensor &A, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {}, const poplar::OptionFlags &options = {})

Compute the reciprocal square root for each element in `A`.

Return

A tensor where each element is equivalent to the result of `1 / sqrt(a)`, where `a` is an element of `A`.

Parameters
• `graph`: The graph to update.

• `A`: A tensor of elements.

• `prog`: The sequence to extend with the execution of the expression evaluation.

• `debugContext`: Optional debug information

• `options`: Element-wise options. See map().