Implementing kernel
C++ engine symbols that back this Python API.Return the k largest values along dim and their indices.
Both outputs have size k along dim; all other dims match
input. The result is unsorted unless the backend chooses to
sort it as a side effect.
Parameters
inputTensorSource tensor.
kintNumber of top elements to return. Must satisfy
0 < k <= input.size(dim).dimDimLike= ...Reduction axis.
Returns
Notes
For the k-th order statistic only, prefer kthvalue. For
full sort, prefer sort.
Examples
>>> import lucid
>>> x = lucid.tensor([1.0, 5.0, 3.0, 4.0, 2.0])
>>> v, i = lucid.topk(x, k=3, dim=0)
>>> v
Tensor([5., 4., 3.])