tf.one_hot返回<tf.Tensor'one_hot:0'shape =(?, 5)dtype = float32>

时间:2019-11-15 06:39:13

标签: python tensorflow one-hot-encoding multilabel-classification categorization

由于形状为“无”,因此无法进一步处理。在one_hot编码后,我需要完整的形状。

labels = [0, 0, 0, 0, 0, 0, 0, 1]
one_hot_labels = tf.one_hot(labels,5)

返回哪个

<tf.Tensor 'one_hot:0' shape=(?, 5) dtype=float32>)

这会导致值错误

ValueError: All shapes must be fully defined: 
TensorShape([Dimension(None), Dimension(5)])

0 个答案:

没有答案