美文网首页
Can not convert a ndarray into a

Can not convert a ndarray into a

作者: 猴子喜 | 来源:发表于2018-11-30 16:48 被阅读0次

错误

第一次运行feed的时候很正常,第二次开始报错:Can not convert a ndarray into a Tensor or Operation.

 test_fc1, test_fc2, Ys = sess.run([test_fc1, test_fc2, fc3], 
                                              feed_dict = {x1:xs1, x2:xs2, test_x1:test_img_raw, test_x2:test_img_raw1}) 

原因

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

改正

test1, test2, Ys = sess.run([test_fc1, test_fc2, fc3], 
                                              feed_dict = {x1:xs1, x2:xs2, test_x1:test_img_raw, test_x2:test_img_raw1}) 

相关文章

网友评论

      本文标题:Can not convert a ndarray into a

      本文链接:https://www.haomeiwen.com/subject/gcwhcqtx.html