Function marian::topk

Function Documentation

Expr2 marian::topk(Expr a, int k, int axis, bool descending = true)

Returns top k elements of an expression along an axis.

Return a 2-tuple (values, indices) of the k largest, or smallest, elements of an expression along a specified axis. The output is ordered according to the value of descending.

Return

An ordered 2-tuple of Expressions

Parameters
  • a: Expression to search

  • k: Number of elements to return

  • axis: Axis to along which to operate

  • descending: If true, consider the largest elements. Otherwise, consider the smallest elements. Default is true.