Implementing kernel
C++ engine symbols that back this Python API.Return the k-th smallest value along dim.
k is 1-based: k=1 is the minimum, k=size(dim) the maximum.
Only the values come back. The reference framework returns a
(values, indices) pair; for the position here, take slot k - 1
of lucid.argsort(input, dim) along dim.
Parameters
inputTensorSource tensor.
kintRank of the desired order statistic (1-based).
dimint= -1Reduction axis.
keepdimbool= FalseRetain the reduced dim with size 1.
Returns
TensorThe k-th smallest values; input.shape with dim removed
(or kept as 1).
Raises
LucidErrorIf
k is outside [1, size(dim)].Examples
>>> import lucid
>>> x = lucid.tensor([5.0, 1.0, 4.0, 2.0, 3.0])
>>> lucid.kthvalue(x, k=2, dim=0)
Tensor(2.)