【发布时间】:2017-07-17 15:16:22
【问题描述】:
在我看来,numpy 函数bincount 非常好用且易于使用,所以我很自然地使用了 TensorFlow 中的类比函数。最近我了解到,不幸的是tf.bincount 没有 GPU 支持(您可以阅读here)。有没有其他方法可以在 TensorFlow with GPU 中高效地进行加权直方图,如下例所示?
sess = tf.Session()
values = tf.random_uniform((1,50),10,20,dtype = tf.int32)
weights = tf.random_uniform((1,50),0,1,dtype = tf.float32)
counts = tf.bincount(values, weights = weights)
histogram = sess.run(counts)
print(histogram)
【问题讨论】:
标签: python tensorflow gpu tensorflow-gpu