Method TopK
TopK(TensorFloat, TensorFloat, TensorInt, int, int, bool)
Calculates the top-K largest or smallest elements of an input tensor along a given axis.
Declaration
void TopK(TensorFloat X, TensorFloat values, TensorInt indices, int k, int axis, bool largest)
Parameters
Type | Name | Description |
---|---|---|
TensorFloat | X | The input tensor. |
TensorFloat | values | The output tensor to be computed and filled with the top K values from the input tensor. |
TensorInt | indices | The output tensor to be computed and filled with the corresponding input tensor indices for the top K values from the input tensor. |
int | k | The number of elements to calculate. |
int | axis | The axis along which to perform the top-K operation. |
bool | largest | Whether to calculate the top-K largest elements. If this is |