8#ifndef popops_Reduce_hpp
9#define popops_Reduce_hpp
14#include "poplar/Graph.hpp"
15#include "poplar/Program.hpp"
16#include <poplar/OptionFlags.hpp>
27 : op(op), update(update) {
42 : op(op), update(update), scale(scale) {
48 bool update =
false) =
delete;
102 const std::vector<std::size_t> &dims,
ReduceParams params,
113 const std::vector<std::size_t> &dims,
ReduceParams params,
127 const std::vector<std::size_t> &dims,
ReduceParams params,
158 const std::vector<std::size_t> &dims,
ReduceParams params,
159 std::vector<poplar::ComputeSet> &css,
164 const std::vector<std::size_t> &dims, ReduceParams params,
165 std::vector<poplar::ComputeSet> &css,
171 const std::vector<std::size_t> &dims, ReduceParams params,
172 std::vector<poplar::ComputeSet> &css,
184 std::vector<std::size_t> dims;
191 std::string debugName;
195 std::string debugName =
"")
196 : in(std::move(in)), dims(std::move(dims)), params(std::move(params)),
197 useOutType(true), outType(outType), debugName(std::move(debugName)) {}
201 : in(std::move(in)), dims(std::move(dims)), params(std::move(params)),
203 debugName(std::move(debugName)) {}
226 const std::vector<SingleReduceOp> &reductions,
227 std::vector<poplar::Tensor> &outputs,
Read/write types of operations used in a reduce.
DebugContext gathers the common external parameters of the context of an operation.
Definition: DebugContext.hpp:221
This class represents a graph program to be executed on the IPU.
Definition: Graph.hpp:52
A set of option/value string flags to be used in various APIs.
Definition: OptionFlags.hpp:24
A reference to a subset of tensor elements.
Definition: Tensor.hpp:38
Class representing device data types.
Definition: Type.hpp:42
Program that executes a sequence of programs.
Definition: Program.hpp:77
Poplar classes and functions.
Definition: ArrayRef.hpp:14
Common functions, such as elementwise and reductions.
Definition: AllTrue.hpp:15
Operation
Type of operation to use in a reduction.
Definition: OperationDef.hpp:15
void reduceMany(poplar::Graph &graph, const std::vector< SingleReduceOp > &reductions, std::vector< poplar::Tensor > &outputs, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext={}, const poplar::OptionFlags &options={})
Perform many reductions (in parallel if possible).
void reduceWithOutput(poplar::Graph &graph, const poplar::Tensor &in, const poplar::Tensor &out, const std::vector< std::size_t > &dims, ReduceParams params, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext={}, const poplar::OptionFlags &options={})
Apply a reduction operation to a tensor.
poplar::Tensor reduce(poplar::Graph &graph, const poplar::Tensor &in, const poplar::Type &outType, const std::vector< std::size_t > &dims, ReduceParams params, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext={}, const poplar::OptionFlags &options={})
Apply a reduction operation to a tensor.
Define a PopLibs exception.
Stores parameters for the reduce operation, as well as the basic operation being performed (for examp...
Definition: Reduce.hpp:23
ReduceParams(popops::Operation op, bool update, poplar::Tensor scale)
Define the details of the reduce operation that will be performed by the reduce() and reduceWithOutpu...
Definition: Reduce.hpp:41
The parameterisation of the inputs to a single reduction for the reduceMany() function.
Definition: Reduce.hpp:182
bool useOutType
Note that if useOutType is false then the element type of in is used.
Definition: Reduce.hpp:189