TopKUnique

public final class TopKUnique

Returns the TopK unique values in the array in sorted order. The

running time is proportional to the product of K and the input size. Sorting the whole array is more efficient for sufficiently large values of K. The median-of-medians algorithm is probably faster, but difficult to implement efficiently in XLA. If there are fewer than K unique numbers (not NANs), the results are padded with negative infinity. NaNs are never returned. Subnormal numbers are flushed to zero. If an element appears at multiple indices, the highest index is returned. If a TopK element never appears in the input due to padding values, the indices are padded with negative one. If a padding value appears in the input and padding is needed, the highest index of the padding value will be returned. The semantics are not the same as kth_order_statistic.

Public Methods

static TopKUnique
create(Scope scope, Operand<Float> input, Long k)
Factory method to create a class wrapping a new TopKUnique operation.
Output<Float>
topk()
Output<Integer>

Inherited Methods

Public Methods

public static TopKUnique create (Scope scope, Operand<Float> input, Long k)

Factory method to create a class wrapping a new TopKUnique operation.

Parameters
scope current scope
Returns
  • a new instance of TopKUnique

public Output<Float> topk ()

public Output<Integer> topkIndices ()