Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot feed value of shape (1, 1, 1, 1) for Tensor 'Placeholder_1:0', which has shape '(7, 1, 1, 1)' #366

Open
Hongyuan-Liu opened this issue Apr 21, 2023 · 1 comment

Comments

@Hongyuan-Liu
Copy link

我在用rknn转换百度的paddle的shitu模型pplcnet,其实就是一个特征提取网络,用mmse量化出现如下问题:
2023-04-21 06:41:42.264360: W tensorflow/compiler/jit/mark_for_compilation_pass.cc:1412] (One-time warning): Not using XLA:CPU for cluster because envvar TF_XLA_FLAGS=--tf_xla_cpu_global_jit was not set. If you want XLA:CPU, either set that envvar, or use experimental_jit_scope to enable XLA:CPU. To confirm that XLA is active, pass --vmodule=xla_compilation_cache=1 (as a proper command-line flag, not via TF_XLA_FLAGS) or set the envvar XLA_FLAGS=--xla_hlo_profile.
W:tensorflow:From /usr/local/lib/python3.6/dist-packages/rknn/api/rknn.py:278: The name tf.nn.avg_pool is deprecated. Please use tf.nn.avg_pool2d instead.

/usr/local/lib/python3.6/dist-packages/scipy/ndimage/interpolation.py:611: UserWarning: From scipy 0.13.0, the output shape of zoom() is calculated with round() instead of int() - for these inputs the size of the returned array has changed.
"the returned array has changed.", UserWarning)
MMSE Quant Step 0: 94%|#######################################3 | 106/113 [01:42<00:07, 1.07s/it]E Run layer Mul_p2o.Mul.12_4 catch exception: Cannot feed value of shape (1, 1, 1, 1) for Tensor 'Placeholder_1:0', which has shape '(7, 1, 1, 1)'
MMSE Quant Step 0: 95%|#######################################7 | 107/113 [01:42<00:05, 1.04it/s]
E Catch exception when building RKNN model!
E Traceback (most recent call last):
E File "rknn/base/RKNNlib/app/medusa/workspace.py", line 498, in rknn.base.RKNNlib.app.medusa.workspace.Workspace.sparse_run
E File "rknn/base/RKNNlib/RKNN_session.py", line 37, in rknn.base.RKNNlib.RKNN_session.RKNNSession.run
E File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 950, in run
E run_metadata_ptr)
E File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1149, in _run
E str(subfeed_t.get_shape())))
E ValueError: Cannot feed value of shape (1, 1, 1, 1) for Tensor 'Placeholder_1:0', which has shape '(7, 1, 1, 1)'
E During handling of the above exception, another exception occurred:
E Traceback (most recent call last):
E File "rknn/base/RKNNlib/RK_nn.py", line 579, in rknn.base.RKNNlib.RK_nn.RKnn.quantize
E File "rknn/base/RKNNlib/app/medusa/quantization.py", line 153, in rknn.base.RKNNlib.app.medusa.quantization.Quantization.run
E File "rknn/base/RKNNlib/app/medusa/quantization.py", line 62, in rknn.base.RKNNlib.app.medusa.quantization.Quantization._run_quantization
E File "rknn/base/RKNNlib/app/medusa/workspace.py", line 501, in rknn.base.RKNNlib.app.medusa.workspace.Workspace.sparse_run
E File "rknn/api/rknn_log.py", line 323, in rknn.api.rknn_log.RKNNLog.e
E ValueError: Run layer Mul_p2o.Mul.12_4 catch exception: Cannot feed value of shape (1, 1, 1, 1) for Tensor 'Placeholder_1:0', which has shape '(7, 1, 1, 1)'
E Please feedback the detailed log file <log_feedback_to_the_rknn_toolkit_dev_team.log> to the RKNN Toolkit development team.
E You can also check github issues: https://github.com/rockchip-linux/rknn-toolkit/issues
build model failed.
如果不用mmse,采用kl_divergence、normal不会报错,但是精度损失比较严重。

@nicklezheng
Copy link

nicklezheng commented Apr 24, 2024

我使用toolkit1.7.5采用mmse量化时遇到了类似的问题

E Run sub net (layer: Concat_Concat_36_62_RKNN_mark_perm_163) catch exception: Cannot feed value of shape (1, 20, 36, 64) for Tensor 'Placeholder:0', which has shape '(100, 20, 36, 64)'
E Catch exception when building RKNN model!
E Traceback (most recent call last):
E   File "rknn\base\RKNNlib\app\medusa\quantization.py", line 153, in rknn.base.RKNNlib.app.medusa.quantization.Quantization.run
E   File "rknn\base\RKNNlib\app\medusa\quantization.py", line 62, in rknn.base.RKNNlib.app.medusa.quantization.Quantization._run_quantization
E   File "rknn\base\RKNNlib\app\medusa\workspace.py", line 987, in rknn.base.RKNNlib.app.medusa.workspace.Workspace.sparse_run
E   File "rknn\base\RKNNlib\app\medusa\workspace.py", line 592, in rknn.base.RKNNlib.app.medusa.workspace.Workspace._mmse_fine_tune_layers
E   File "rknn\base\RKNNlib\quantization\mmse_method.py", line 339, in rknn.base.RKNNlib.quantization.mmse_method.mmse_record_outputs
E TypeError: 'NoneType' object is not subscriptable

请问kl_divergence和normal哪种量化效果会更好些?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants