代码报错回查遇到的一些坑,真的是坑,OOM的错竟然检查了一天才检查出来问题所在,故记录一下遇到的坑。
OOM error
解决方案:
- 显卡真的OOM了,检查显卡有没有其他任务;
- 检查代码;
- 代码无误的情况下,这种错90%的概率是因为作处理的数据超过GPU的显存,应该减少batch的大小;
merge_all
报错
InvalidArgumentError (see above for traceback): You must feed a value for placeholder tensor ‘Placeholder_19’ with dtype float and shape [?,16,16,17]
[[node Placeholder_19 (defined at ***.py:35) ]]
[[{{node _arg_Log_90_0_11}}]]
代码
self.summary_op = tf.summary.merge_all()
情况出现原因
程序中定义了多个图
解决方案
tf.summary.scalar('loss', distill_policyLoss)
self.summary_op = tf.summary.merge(tf.get_collection(tf.GraphKeys.SUMMARIES,'loss')) #这里的loss可以换成其他的op