Backends/SiaNet.Backend.Torch/TypeGeneration.cs
/// <summary>
///   Finds the top k of all the elements of the tensor along the given dimension.
/// </summary>
/// <param name="k">The number of elements to fetch.</param>
/// <param name="dim">The dimension along which to sort and find k elements.</param>
/// <param name="dir">0 if ascending, 1 if descending.</param>
/// <param name="sorted">1 if the result should be sorted, 0 if they should keep their original order.</param>
/// <returns>A tuple containing the values and indices of the top 'k' elements.</returns>
Finds the top k of all the elements of the tensor along the given dimension.
Finds the top k of all the elements of the tensor along the given dimension .
public System.Tuple<IntTensor, LongTensor> TopK (long k, int dim, int dir, bool sorted)
        {
            var values = new IntTensor ();
            var indices = new LongTensor ();
            THIntTensor_topk (values.handle, indices.handle, this.handle, k, dim, dir, sorted?1:0);
            return new System.Tuple<IntTensor, LongTensor>(values, indices);
        }
public System . Tuple < IntTensor , LongTensor > TopK ( long k , int dim , int dir , bool sorted ) { var values = new IntTensor ( ) ; var indices = new LongTensor ( ) ; THIntTensor_topk ( values . handle , indices . handle , this . handle , k , dim , dir , sorted ? 1 : 0 ) ; return new System . Tuple < IntTensor , LongTensor > ( values , indices ) ; }
Finds the top k of all the elements of the tensor along the given dimension.
Finds the top k of all the elements of the tensor along the given dimension .
A tuple containing the values and indices of the top 'k' elements.
A tuple containing the values and indices of the top ' k ' elements .
k
long
The number of elements to fetch.
The number of elements to fetch .
dim
int
The dimension along which to sort and find k elements.
The dimension along which to sort and find k elements .
dir
int
0 if ascending, 1 if descending.
0 if ascending 1 if descending .
sorted
bool
1 if the result should be sorted, 0 if they should keep their original order.
1 if the result should be sorted 0 if they should keep their original order .