6#ifndef _popops_TopK_hpp_
7#define _popops_TopK_hpp_
9#include <poplar/Graph.hpp>
10#include <poplar/Program.hpp>
11#include <poplar/Tensor.hpp>
38std::ostream &operator<<(std::ostream &os, const
TopKParams &p);
53 const std::vector<std::
size_t> &shape,
55 const
poplar::DebugContext &debugContext = {});
90std::pair<poplar::Tensor, poplar::Tensor>
112std::pair<poplar::Tensor, poplar::Tensor>
Defintions of sort ordering.
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
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
poplar::Tensor topK(poplar::Graph &graph, poplar::program::Sequence &prog, const poplar::Tensor &t, const TopKParams ¶ms, const poplar::DebugContext &debugContext={})
Return the top k values in the innermost dimension of a tensor.
SortOrder
Defines a required order for sorting operations.
Definition: SortOrder.hpp:14
poplar::Tensor createTopKInput(poplar::Graph &graph, const poplar::Type &type, const std::vector< std::size_t > &shape, const TopKParams ¶ms, const poplar::DebugContext &debugContext={})
Create an return a new tensor laid out optimally to be used as an input to a topK operation with the ...
std::pair< poplar::Tensor, poplar::Tensor > topKWithPermutation(poplar::Graph &graph, poplar::program::Sequence &prog, const poplar::Tensor &t, const TopKParams ¶ms, const poplar::DebugContext &debugContext={})
Return the top k values in the innermost dimension of a tensor along with the indices of those values...
std::pair< poplar::Tensor, poplar::Tensor > topKKeyValue(poplar::Graph &graph, poplar::program::Sequence &prog, const poplar::Tensor &keys, const poplar::Tensor &values, const TopKParams ¶ms, const poplar::DebugContext &debugContext={})
Return the top k values in the innermost dimension of a tensor along with the permutation of another ...
Parameters for topK* APIs.
Definition: TopK.hpp:19
unsigned k
The number of outputs from the top k operation.
Definition: TopK.hpp:23
SortOrder sortOrder
The required ordering of elements in the resulting tensor.
Definition: TopK.hpp:28
bool largest
If true, return the top k largest elements.
Definition: TopK.hpp:26
bool stableSort
When sortOrder != SortOrder::NONE and stableSort is true, the relative order of values that compare e...
Definition: TopK.hpp:32