Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python tensorflow 2.0.0中tf.one_hot的等价性是什么_Python_Tensorflow_Tensorflow2.0 - Fatal编程技术网

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

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

在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_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.