Skip to main content

ClikaRT::ops::bincount

function

bincount()

Tensor bincount(
    Tensor x,
    OptionalTensor weights = {},
    int64_t minlength = 0
)

Occurrence count (or weight sum) of each non-negative integer value.

The output is 1-D with length max(x) + 1, floored at minlength; entry i counts how often i occurs (with weights bound, it sums the weights at those positions instead).

Parameters

  • x: non-negative integers; 1-D.
  • weights: optional per-position weights, same shape as x.
  • minlength: minimum output length; default 0.

Returns: the 1-D counts (integer) or weight sums (weights' dtype).

Throws

  • ClikaRT::Error: (INVALID_ARGUMENT) when x carries a negative value or is not integer-typed.

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