#include <popops/ElementWiseUtil.hpp>

Supporting functions for element-wise operations.

namespace popops

Common functions, such as elementwise and reductions.


poplar::Tensor createOutputForElementWiseOp(poplar::Graph &graph, const std::vector<poplar::Tensor> &inputs, const poplar::Type &outputType, const poplar::DebugContext &debugContext = {})

Create a tensor for use as the output of an element-wise operation (operation with no dependency between more than one element of the output and any given element of any input tensor).

Use the mapping of this tensor to map element-wise operations to tiles to produce an operation that is computationally balanced across tiles and which minimises exchange.

All input tensors must have the same shape.

  • graph – A graph to add the tensor to and which the inputs belong to.

  • inputs – List of input tensors for the element-wise operation.

  • outputType – The element type of the tensor.

  • debugContext – Optional debug information.


A tensor with the same shape as the given inputs, with a complete tile mapping.