2
 train_label = tf.keras.backend.one_hot(train_label,3)
 train_label = tf.one_hot(train_label,3)

在 tensorflow 2.0.0 中给出以下错误

InternalError: Could not find valid device for node.

节点:{{node OneHot}}

4

1 回答 1

3

train_label应该是INT类型数据。例如:

train_label = [1, 2 ,3]
train_label = tf.one_hot(train_label,3) // work

train_label = [1., 2., 3.]
train_label = tf.one_hot(train_label,3) // InternalError: Could not find valid device for node. 
于 2019-05-17T02:35:51.537 回答