aesara.tensor.bincount#
- aesara.tensor.bincount(x, weights=None, minlength=None, assert_nonneg=False)[source]#
Count number of occurrences of each value in an array of integers.
The number of bins (of size 1) is one larger than the largest value in
x
. If minlength is specified, there will be at least this number of bins in the output array (though it will be longer if necessary, depending on the contents ofx
). Each bin gives the number of occurrences of its index value inx
. Ifweights
is specified the input array is weighted by it, i.e. if a valuen
is found at positioni
,out[n] += weight[i]
instead ofout[n] += 1
.- Parameters:
x – A one dimensional array of non-negative integers
weights – An array of the same shape as
x
with corresponding weights. Optional.minlength – A minimum number of bins for the output array. Optional.
assert_nonneg – A flag that inserts an
assert_op
to check if every inputx
is non-negative. Optional.versionadded: (..) – 0.6: