has invalid type <class 'numpy.ndarray'>, must be a string or Tensor

转自: https://blog.csdn.net/jacke121/article/details/78833922

has invalid type <class 'numpy.ndarray'>, must be a string or Tensor. (Can not convert a ndarray into a Tensor or Operation.)

原因:变量命名重复了

image_test, label_test = get_batch(x_val, y_val, w, h, batch_size, CAPACITY)
img_test, label_test = sess.run([image_test, label_test])

解决方法:把任意一个变量名改了就好了

原文地址:https://www.cnblogs.com/ying-chease/p/9510276.html