Method TopK
TopK(TensorFloat, int, int, bool, bool)
Calculates the top-K largest or smallest elements of an input tensor along a given axis.
Declaration
public Tensor[] TopK(TensorFloat X, int k, int axis, bool largest, bool sorted)
Parameters
| Type | Name | Description |
|---|---|---|
| TensorFloat | X | 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 |
| bool | sorted | Whether to return the elements in sorted order. |
Returns
| Type | Description |
|---|---|
| Tensor[] | The computed output tensor. |