Python tensorflow 2.0.0中tf.one_hot的等价性是什么
在tensorflow 2.0.0中给出以下错误Python tensorflow 2.0.0中tf.one_hot的等价性是什么,python,tensorflow,tensorflow2.0,Python,Tensorflow,Tensorflow2.0,在tensorflow 2.0.0中给出以下错误 train_label = tf.keras.backend.one_hot(train_label,3) train_label = tf.one_hot(train_label,3) 节点:{Node OneHot}train\u标签应为INT类型数据。例如: InternalError: Could not find valid device for node. 这似乎不是问题,请提供更多(全部)导致此错误的代码 train_lab
train_label = tf.keras.backend.one_hot(train_label,3)
train_label = tf.one_hot(train_label,3)
节点:{Node OneHot}
train\u标签
应为INT
类型数据。例如:
InternalError: Could not find valid device for node.
这似乎不是问题,请提供更多(全部)导致此错误的代码
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.