Python wrappers
Public Python APIs implemented by this engine symbol.Pluck the -th smallest element along dim.
Composite over sort_op + gather_op (+ optional
squeeze_op). After sorting a ascending along dim, we
gather the slice at position k - 1 to obtain the -th smallest
value. Not differentiable — the integer-valued index breaks the chain;
gradient is conventionally treated as zero.
Math
Let be a sorted ascending along dim. Then
See Also
sort_op — produces the full sorted view.
Parameters
aTensorImplPtrSource tensor of rank .
kint641-based rank of the value to return. Must satisfy
1 <= k <= a.shape[dim].dimintAxis to reduce along. Negative values wrap modulo
a.ndim.keepdimboolIf
true, retain a size-1 axis at dim; otherwise the axis is squeezed off.Returns
TensorImplPtrTensor with the same shape as a except size 1 (or removed) at dim. Dtype matches a.
Raises
FailureIf
a is null or k is outside [1, a.shape[dim]].IndexErrorIf
dim is out of range.Notes
Unlike the reference framework's API, this entry point returns only the
value — the matching index can be recovered via argsort_op if
required.