|
本帖最后由 zhr_19970822 于 2021-1-22 19:09 编辑
LSTM是打算从pytorch转到onnx再转到RKNNpytorch中的代码:self.rnn = nn.LSTM(nIn, nHidden, num_layers=1, bidirectional=True) (pytorch转onnx是成功的了)
onnx转RKNN的时候报错:
--> config model
done
--> Loading model
W Call onnx.optimizer.optimize fail, skip optimize
E Calc node LSTM : LSTM_323 output shape fail
W ----------------Warning(1)----------------
E Catch exception when loading onnx model: test.onnx!
E Traceback (most recent call last):
E File "rknn/base/RKNNlib/onnx_ir/onnx_numpy_backend/shape_inference.py", line 57, in rknn.base.RKNNlib.onnx_ir.onnx_numpy_backend.shape_inference.infer_shape
E File "rknn/base/RKNNlib/onnx_ir/onnx_numpy_backend/ops/LSTM.py", line 122, in rknn.base.RKNNlib.onnx_ir.onnx_numpy_backend.ops.LSTM.LSTM
E File "rknn/base/RKNNlib/onnx_ir/onnx_numpy_backend/ops/LSTM.py", line 48, in rknn.base.RKNNlib.onnx_ir.onnx_numpy_backend.ops.LSTM.lstm_helper.__init__
E NotImplementedError
E During handling of the above exception, another exception occurred:
E Traceback (most recent call last):
E File "rknn/api/rknn_base.py", line 264, in rknn.api.rknn_base.RKNNBase.load_onnx
E File "rknn/base/RKNNlib/RK_nn.py", line 135, in rknn.base.RKNNlib.RK_nn.RKnn.load_onnx
E File "rknn/base/RKNNlib/app/importer/import_onnx.py", line 111, in rknn.base.RKNNlib.app.importer.import_onnx.Importonnx.run
E File "rknn/base/RKNNlib/converter/convert_onnx.py", line 85, in rknn.base.RKNNlib.converter.convert_onnx.convert_onnx.__init__
E File "rknn/base/RKNNlib/converter/convert_onnx.py", line 434, in rknn.base.RKNNlib.converter.convert_onnx.convert_onnx._shape_inference
E File "rknn/base/RKNNlib/onnx_ir/onnx_numpy_backend/shape_inference.py", line 62, in rknn.base.RKNNlib.onnx_ir.onnx_numpy_backend.shape_inference.infer_shape
E File "rknn/api/rknn_log.py", line 312, in rknn.api.rknn_log.RKNNLog.e
E ValueError: Calc node LSTM : LSTM_323 output shape fail
done
--> Building model
Traceback (most recent call last):
File "test.py", line 26, in <module>
ret = rknn.build(do_quantization=True, dataset='./dataset.txt')
File "/usr/local/lib/python3.6/dist-packages/rknn/api/rknn.py", line 228, in build
inputs = self.rknn_base.net.get_input_layers()
AttributeError: 'NoneType' object has no attribute 'get_input_layers'
我通过Netron查看了onnx中该层的参数,
发现这里面的参数除了sequence_lens没有,其他都是有定义的。
是这个sequence_lens没有的问题嘛?
如果是的话 要怎么修改呢? 如果不是的话 问题出在哪里?
|
|