Skip to content Skip to sidebar Skip to footer

Tensorflow Softmax_cross...() Function Float Type Error

I resolved in issue from this post, and the use Olivier recommended using the softmax_cross_entropy_with_logits() function. He is correct, but I'm getting a weird data type error.

Solution 1:

You have created a placeholder with:

y = tf.placeholder(tf.float32, [None, n_input, n_input, n_classes], name="ground_truth")

The error is quite clear:

You must feed a value for placeholder tensor 'ground_truth'

When calling sess.run([cost, accuracy], feed_dict={x: batch_x, temp_y: batch_y, keep_prob: 1.0}), you are not feeding the parameter y.

You should instead use:

batch_y = convert_to_2_channel(batch_y, batch_size)
# do not reshape batch_y now
sess.run([cost, accuracy], feed_dict={x: batch_x,
                                      y: batch_y,
                                      keep_prob: 1.0})

Post a Comment for "Tensorflow Softmax_cross...() Function Float Type Error"