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
indices
tensor must be equal to the size of dimension 0 ofparams
. The ith element ofindices
represents an index in the ith row of the params tensor.If ith element of the
indices
tensor is less than 0 or greater than the width ofparams
then a NaN is stored into the ith element of the output. If the ith element of theindices
tensor is equal toMASKED_LABEL_CODE
then 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 = {})