Open kiyojimini opened 5 months ago
您好,错误是发生在这里:
... File "./x2paddle_code.py", line 103, in forward x2paddle_onnx__Gemm_190 = paddle.reshape(x=x2paddle_onnx__Flatten_189, shape=[1, 512]) ... InvalidArgumentError: The 'shape' in ReshapeOp is invalid. The input tensor X'size must be equal to the capacity of 'shape'. But received X's shape = [2, 512, 1, 1], X's size = 1024, 'shape' is [1, 512], the capacity of 'shape' is 512. [Hint: Expected capacity == in_size, but received capacity:512 != in_size:1024.] (at ../paddle/fluid/operators/reshape_op.cc:234) [operator < reshape2 > error]
是纬度不匹配的问题,请修改该代码为后再次尝试:
x2paddle_onnxGemm_190 = paddle.reshape(x=x2paddle_onnxFlatten_189, shape=[2, 512])
Traceback (most recent call last): File "run.py", line 212, in
main()
File "run.py", line 205, in main
ac.compress()
File "/data/huangyan/anaconda/anaconda3/envs/yolov5sperson/lib/python3.8/site-packages/paddleslim-0.0.0.dev0-py3.8.egg/paddleslim/auto_compression/compressor.py", line 586, in compress
self.single_strategy_compress(strategy, config, strategy_idx,
File "/data/huangyan/anaconda/anaconda3/envs/yolov5sperson/lib/python3.8/site-packages/paddleslim-0.0.0.dev0-py3.8.egg/paddleslim/auto_compression/compressor.py", line 753, in single_strategy_compress
metric = self.eval_function(self._exe, inference_program,
File "run.py", line 104, in eval_function
pred = exe.run(
File "/data/huangyan/anaconda/anaconda3/envs/yolov5sperson/lib/python3.8/site-packages/paddle/base/executor.py", line 1746, in run
res = self._run_impl(
File "/data/huangyan/anaconda/anaconda3/envs/yolov5sperson/lib/python3.8/site-packages/paddle/base/executor.py", line 1952, in _run_impl
ret = new_exe.run(
File "/data/huangyan/anaconda/anaconda3/envs/yolov5sperson/lib/python3.8/site-packages/paddle/base/executor.py", line 831, in run
tensors = self._new_exe.run(
ValueError: In user code:
请问该如何修改呢,期待解答!!