has invalid type , must be a string or Tensor

时间:2024-10-08 10:37:38

转自: https://blog.****.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])

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