Skip to main content

ClikaRT::ops::bucketize

function

bucketize()

Tensor bucketize(
    Tensor x,
    Tensor boundaries,
    bool out_int32 = false,
    bool right = false
)

Bucket index of each x element against a sorted 1-D boundaries.

With right == false (default) an element in [b[i-1], b[i]) maps to bucket i; right == true uses (b[i-1], b[i]]. Output shape mirrors x.

Parameters

  • x: the values to bucket.
  • boundaries: 1-D ascending bucket edges.
  • out_int32: emit Int32 indices instead of Int64; default false.
  • right: flip the half-open side; default false.

Returns: integer bucket indices, shaped like x.

Throws

  • ClikaRT::Error: (INVALID_ARGUMENT) when boundaries is not 1-D.

Declared in ClikaRT/compute/ops.h, line 4570