TensorFlow踩坑记:Can not convert a ndarray into a Tensor or Operation.
·
今天掉进一坑,爬了好一会踩爬出来,先将问题记录一些,谨以此献给出现同样错误的同学,错误:Can not convert a ndarray into a Tensor or Operation.
“` python
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相关运算冲突。
所以将接收的变量名改了就可以了。
改:
“` python
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})
“`
AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。
更多推荐



所有评论(0)