tf.compat.v1.bincount

View source on GitHub

Counts the number of occurrences of each value in an integer array.

tf.compat.v1.bincount(
    arr, weights=None, minlength=None, maxlength=None, dtype=tf.dtypes.int32
)

If minlength and maxlength are not given, returns a vector with length tf.reduce_max(arr) + 1 if arr is non-empty, and length 0 otherwise. If weights are non-None, then index i of the output stores the sum of the value in weights at each index where the corresponding value in arr is i.

Args:

Returns:

A vector with the same dtype as weights or the given dtype. The bin values.