版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/fyq201749/article/details/82666854
tf.bincount()
计算整数数组中每个值的出现次数,从0开始。
参数:
tf.bincount(
arr,
weights=None,
minlength=None,
maxlength=None,
dtype=tf.int32
)
使用案例:
import tensorflow as tf
a = [0, 1, 1, 2, 2, 10]
sess = tf.Session()
print(sess.run(tf.bincount(a, minlength=3, maxlength=5)))#[0 2 2 0 0]