SequenceSlice
#include <popops/SequenceSlice.hpp>
Support for dynamic slices.
-
namespace poplar
Poplar classes and functions.
-
namespace popops
Common functions, such as elementwise and reductions.
Functions
-
void sequenceSlice(poplar::Graph &graph, const poplar::Tensor &tIn, const poplar::Tensor &tOut, const poplar::Tensor &tN, const poplar::Tensor &tInOffset, const poplar::Tensor &tOutOffset, bool zeroUnused, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {})
Slice a 2d tensor based on offsets specified by a tensor.
Typically this is used to copy subsequences of one tensor to another. The outermost dimension is sliced; tOut[tOutOffset:tOutOffset+tN][…] = tIn[tInOffset:tInOffset+tN][…] for each entry in tN/tInOffset/tOutOffset; entries after the first tN==0 may be ignored. Unreferenced elements of tOut are zeroed if zeroUnused is set. The same output element should not be written by multiple inputs.
tIn
andtOut
must have rank >=2. The outer dimension is sliced; the product of the inner dimensions must match.tInOffset
,tOutOffset
andtN
must be 1d and the same size.- Parameters
graph – The Poplar graph.
tIn – The source tensor.
tOut – The destination tensor.
tN – The number of elements to copy.
tInOffset – First element read from
tIn
.tOutOffset – First element written in
tOut
.zeroUnused – Whether to zero unreferenced
tOut
elements.prog – The program to be extended.
debugContext – Optional debug information.
-
void sequenceSlice(poplar::Graph &graph, const poplar::Tensor &tIn, const poplar::Tensor &tOut, const poplar::Tensor &tN, const poplar::Tensor &tInOffset, const poplar::Tensor &tOutOffset, bool zeroUnused, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {})