校准时提示“Invalid argument: You must feed a value for placeholder tensor **”
问题描述
训练后量化场景,修改模型后执行校准过程时,使用原始模型的输入输出做推理,报错提示必须给一个占位符输入数据,校准过程中断。提示信息如下:
Traceback (most recent call last): File "xxx/site-packages/tensorflow_core/python/client/session.py", line 1365, in _do_call return fn(*args) File "xxx/site-packages/tensorflow_core/python/client/session.py", line 1350, in _run_fn target_list, run_metadata) File "xxx/site-packages/tensorflow_core/python/client/session.py", line 1443, in _call_tf_sessionrun run_metadata) tensorflow.python.framework.errors_impl.InvalidArgumentError: 2 root error(s) found. (0) Invalid argument: You must feed a value for placeholder tensor 'input' with dtype float and shape [1,32,32,10] [[{{node input}}]] [[ConstantFoldingCtrl/conv1/search_n_quant/search_n_quant_SEARCHN/cond/Switch_0/_22]] (1) Invalid argument: You must feed a value for placeholder tensor 'input' with dtype float and shape [1,32,32,10] [[{{node input}}]]
可能原因
调用quantize_model处理用户的图结构时,会进行融合、替换等图操作,可能改变用户模型的输出,将原有的输出节点与placeholder连接。
处理建议
该场景下调用quantize_model时,会有warning信息提示输出节点发生变化,在执行校准的过程中,根据提示信息,修改输出节点即可。
父主题: FAQ