繁体   English   中英

tensorflow 2.0.0 中 tf.one_hot 的等价物是什么

[英]what is the equivalence of tf.one_hot in tensorflow 2.0.0

 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}}

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. 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM