SelectScalarFromRows
#include <popops/SelectScalarFromRows.hpp>
Select values from rows of a tensor.
-
namespace popops
Common functions, such as elementwise and reductions.
Functions
-
poplar::Tensor selectScalarFromRows(poplar::Graph &graph, const poplar::Tensor ¶ms, const poplar::Tensor &indices, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {})
For each row in the 2D tensor params, select a single scalar value.
Aggregate the resulting scalars into a 1D tensor.
The size of the
indicestensor must be equal to the size of dimension 0 ofparams. The ith element ofindicesrepresents an index in the ith row of the params tensor.If ith element of the
indicestensor is less than 0 or greater than the width ofparamsthen a NaN is stored into the ith element of the output. If the ith element of theindicestensor is equal toMASKED_LABEL_CODEthen zero is stored into the ith element of the output.- Parameters
graph – The Poplar graph.
params – A 2D tensor, the element type must be either float or half.
indices – A 1D tensor, the element type must be unsigned integer.
prog – The program to be extended.
debugContext – Optional debug information.
- Returns
A 1D tensor containing in the ith position the scalar
params[indices[i]].
-
poplar::Tensor selectScalarFromRows(poplar::Graph &graph, const poplar::Tensor ¶ms, const poplar::Tensor &indices, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {})