Skip to content Skip to sidebar Skip to footer

TypeError: Fetch Argument Has Invalid Type Float32, Must Be A String Or Tensor

I'm training a CNN quite similar to the one in this example, for image segmentation. The images are 1500x1500x1, and labels are of the same size. After defining the CNN structure,

Solution 1:

Where you use loss = sess.run(loss), you redefine in python the variable loss.

The first time it will run fine. The second time, you will try to do:

sess.run(1.4415792e+2)

Because loss is now a float.


You should use different names like:

loss_val, acc = sess.run([loss, accuracy], feed_dict={x: batch_x, y: batch_y, keep_prob: 1.})

Post a Comment for "TypeError: Fetch Argument Has Invalid Type Float32, Must Be A String Or Tensor"