x2paddle支持动态shape吗?
Created by: TreeDiagram-1
在进行LSTM和GRU的模型转换时遇到了下面的问题: File "./onnx_decoder.py", line 498, in check_model_running_state ipt.shape).astype(datatype) File "mtrand.pyx", line 430, in numpy.random.mtrand.RandomState.random File "mtrand.pyx", line 421, in numpy.random.mtrand.RandomState.random_sample File "_common.pyx", line 256, in numpy.random._common.double_fill TypeError: 'str' object cannot be interpreted as an integer
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "convert.py", line 21, in def arg_parser(): File "convert.py", line 252, in main onnx2paddle(args.model, args.save_dir, params_merge) File "convert.py", line 173, in onnx2paddle model = ONNXDecoder(model_path) File "/home/gpu/.local/lib/python3.5/site-packages/x2paddle/decoder/onnx_decoder.py", line 325, in init self.check_model_running_state(onnx_model) File "/home/gpu/.local/lib/python3.5/site-packages/x2paddle/decoder/onnx_decoder.py", line 503, in check_model_running_state "onnxruntime inference onnx model failed, Please confirm the correctness of onnx model by onnxruntime, if onnx model is correct, please submit issue in github." Exception: onnxruntime inference onnx model failed, Please confirm the correctness of onnx model by onnxruntime, if onnx model is correct, please submit issue in github. 下面是pytorch模型转换成onnx的代码,这个模型在进行onnx的check时没有报错。里面用到了dynamic_axes,所以shape会存在‘?’的情况。 dummp_inputs = torch.ones(1, 3) * 2 * np.pi inputs = ['images'] outputs = ['scores'] dynamic_axes = {'images': {1}, 'scores': {1}} torch_out = torch.onnx.export(actor_critic, dummp_inputs, "test.onnx",input_names=inputs, output_names=outputs, export_params=True,dynamic_axes=dynamic_axes) model = onnx.load("./test.onnx") onnx.checker.check_model(model)
有人知道应该怎么解决这种动态shape时遇到的问题吗?麻烦帮看一下,谢谢。