user1928187
user1928187

Reputation: 37

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)

give the following error in tensorflow 2.0.0

InternalError: Could not find valid device for node.

Node: {{node OneHot}}

Upvotes: 2

Views: 350

Answers (1)

tidy
tidy

Reputation: 5097

train_label should be a INT type data. for example:

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. 

Upvotes: 3

Related Questions