searchsorted_op
→TensorImplPtrint searchsorted_op(const int & sorted_1d, const int & values, bool right)Python wrappers
Public Python APIs implemented by this engine symbol.Per-query insertion point into a sorted 1-D reference.
Composite over reshape_op + broadcast_to_op +
(less_op | less_equal_op) + astype_op +
sum_op. The 1-D reference is broadcast to
[1, ..., 1, N] and the queries to S + [1]; both expand to the
full S + [N] grid, the comparison is reduced over the trailing axis,
and the bool F32 I64 cast chain produces the standard
searchsorted dtype. Not differentiable — integer output.
Math
Let be the sorted reference and the query tensor. Then
with being when right = false (leftmost insertion) and
when right = true (rightmost insertion).
See Also
bucketize_op — same operation with the argument order flipped.
Parameters
sorted_1dTensorImplPtrvaluesTensorImplPtrS.rightbooltrue, returns the rightmost (post-equal) insertion point; otherwise the leftmost.Returns
TensorImplPtrint64 tensor of shape S whose entries lie in .
Raises
Failuresorted_1d is not 1-D.Notes
The reduction kernel only supports float dtypes; the bool comparison is
cast to F32 for the sum, then back to I64 to match the canonical
searchsorted dtype.