Skip to content
fn

bucketize_op

→TensorImplPtr
int bucketize_op(const int & values, const int & boundaries, bool right)

Python wrappers

Public Python APIs implemented by this engine symbol.

Bucket-index lookup: alias of searchsorted_op with the operand order flipped to match the bucket-first convention.

Composite — delegates directly to searchsorted_op(boundaries, values, right). Not differentiable.

Math

y…,j=∑i1 ⁣[bi≺v…,j] y_{\ldots, j} = \sum_{i} \mathbb{1}\!\left[ b_i \prec v_{\ldots, j} \right]

with bb = boundaries and the comparison ≺\prec selected by right per searchsorted_op.

See Also

searchsorted_op.

Parameters

valuesTensorImplPtr
Query tensor of arbitrary shape.
boundariesTensorImplPtr
1-D ascending-sorted boundary tensor.
rightbool
If true, queries equal to a boundary land in the higher bucket.

Returns

TensorImplPtr

int64 tensor of the same shape as values whose entries are bucket indices in [0,len(boundaries)][0, \mathrm{len}(\mathrm{boundaries})].