错误总结

(1)TypeError: The value of a feed cannot be a tf.Tensor object. Acceptable feed values include Python scalars, strings, lists, numpy ndarrays, or TensorHandles.For reference, the tensor object was Tensor(“Cast_1:0”, shape=(200, 2304), dtype=int64) which was passed to the feed with key Tensor(“x:0”, shape=(?, 2304), dtype=float32).
解决办法:http://www.bubuko.com/infodetail-2574660.html (未解决)

错误原因是这里的test_images 仅仅是tensorflow数据流图上定义好的,实际上它并不是一个实际的数据,仅仅是一个Tensor,feed的必须是实际的数据。实际的数据需要sees.run来获得。所以只要在上述代码加上:test_images = sess.run(test_images)
https://www.jianshu.com/p/0a85a6ff685b

在TensorFlow中如何将Tensor张量转换为numpy数组?
https://vimsky.com/article/3725.html

(2)TypeError: Fetch argument array () has invalid type <class ‘numpy.ndarray’>, must be a string or Tensor. (Can not convert a ndarray into a Tensor or Operation.)

有同样的问题:https://stackoverflow.com/questions/47632262/typeerror-fetch-argument-array-has-invalid-type-numpy-ndarray-must-be-a-string
新的变量名不应与就变量名一样https://blog.csdn.net/lincoco49/article/details/88102807

TensorFlow:Can not convert a ndarray into a Tensor or Operation.
错误指示是run这里出了错,原因:接收的参数名和run()里面的参数名一样了,这样的话,第一次不会报错,下一次运行中,test_fc1,test_fc2变量名已有了,直接跑会和你前面定义的test_fc1,test_fc2相关运算冲突。
所以将接收的变量名改了就可以了。

Tensorfow中Tensor与Numpy的ndarray转换 https://blog.csdn.net/a1786742005/article/details/84994700

(3)InvalidArgumentError (see above for traceback): logits and labels must be broadcastable: logits_size=[200,7] labels_size=[28700,7]
[[node softmax_cross_entropy_with_logits_sg (defined at E:/LIANLU/6Python/4DeepLearningParagram/2.FaceRecogmition/02_FER_myself/01_FER2013/FER_CNN_1.py:157) = SoftmaxCrossEntropyWithLogits[T=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"](layer11-fc3/add, softmax_cross_entropy_with_logits_sg/Reshape_1)]]

InvalidArgumentError (see above for traceback): logits and labels must be broadcastable: logits_size=[300,7] labels_size=[1,300]
[[node softmax_cross_entropy_with_logits_sg (defined at E:/LIANLU/6Python/4DeepLearningParagram/2.FaceRecogmition/02_FER_myself/01_FER2013/FER_CNN_improve_acc.py:146) = SoftmaxCrossEntropyWithLogits[T=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"](layer11-fc3/add, softmax_cross_entropy_with_logits_sg/Reshape_1)]]

(4)ValueError: Dimensions must be equal, but are 48 and 1 for ‘conv1/Conv2D’ (op: ‘Conv2D’) with input shapes: [?,1,48,48], [11,11,1,64].

(5)ValueError: Rank mismatch: Rank of labels (received 1) should equal rank of logits minus 1 (received 4).
该错误在使用tf.nn.sparse_softmax_cross_entropy_with_logits(logits, labels)语句时产生
logits应为(None,class)
而此时的label应该是一个这样的一维矩阵:
[2 1 2 2 2 1 1 1 1 2]

(6)TypeError: unhashable type: ‘list’

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值