【发布时间】:2019-02-06 15:43:43
【问题描述】:
我知道我可以使用以下命令将张量转换为 one-hot:
one_hot_labels = tf.one_hot(labels,depth=3)
现在我想计算one_hot_labels 中有多少 0 类、1 类和 2 类。最简单的计算方法是什么?
例子:
输入:
one_hot_labels = [[1,0,0],[1,0,0],[0,0,1]]
one_hot_labels.count([1,0,0]) # something like this command
输出:
2
【问题讨论】:
标签: python tensorflow one-hot-encoding