Poplar and PopLibs
Gather.hpp
Go to the documentation of this file.
1// Copyright (c) 2019 Graphcore Ltd. All rights reserved.
8#ifndef popops_Gather_hpp
9#define popops_Gather_hpp
10#include <poplar/Graph.hpp>
11#include <poplar/Program.hpp>
12
13namespace popops {
14
19 std::size_t maxElementsPerTile = 65535;
20
21 GatherParams() = default;
22 GatherParams(std::size_t maxElementsPerTile_)
23 : maxElementsPerTile(maxElementsPerTile_) {}
24};
25
41 const std::vector<std::size_t> &operandShape,
42 unsigned axis, GatherParams params = {},
43 const poplar::DebugContext &debugContext = {});
44
66 const poplar::Tensor &indices, unsigned axis,
68 const poplar::DebugContext &debugContext = {});
69
87 const std::vector<std::size_t> &inputShape,
88 const std::vector<std::size_t> &sliceSizes,
89 std::vector<unsigned> startIndexMap,
90 const poplar::DebugContext &debugContext = {});
91
162 const poplar::Tensor &indices, std::size_t indexVectorDim,
163 const std::vector<std::size_t> &offsetDims,
164 const std::vector<std::size_t> &sliceSizes,
165 const std::vector<std::size_t> &collapsedSliceDims,
166 const std::vector<unsigned> &startIndexMap,
168 const poplar::DebugContext &debugContext = {});
169
170} // namespace popops
171
172#endif // popops_DynamicSlice_hpp
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 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
Common functions, such as elementwise and reductions.
Definition: AllTrue.hpp:15
poplar::Tensor createGatherInput(poplar::Graph &graph, const poplar::Type &type, const std::vector< std::size_t > &operandShape, unsigned axis, GatherParams params={}, const poplar::DebugContext &debugContext={})
Create the input of the gather with only a single gather axis.
poplar::Tensor gather(poplar::Graph &graph, const poplar::Tensor &input, const poplar::Tensor &indices, unsigned axis, poplar::program::Sequence &prog, GatherParams params, const poplar::DebugContext &debugContext={})
The gather operation stitches together several slices (each slice at a potentially different runtime ...
Defines the parameters to a gather operation.
Definition: Gather.hpp:16
std::size_t maxElementsPerTile
Suggested maximum number of elements to place on a tile.
Definition: Gather.hpp:19