TypeError: Fetch argument has invalid type float32, must be a string or Tensor

后端 未结 1 1803
既然无缘
既然无缘 2020-12-29 07:46

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

1条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-29 08:21

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

    0 讨论(0)
提交回复
热议问题