MATLAB Answers

Importing recurrent ONNX to Matlab throws error "ONNX network with multiple inputs or multiple outputs is not supported when one of the network inputs is sequential."

10 views (last 30 days)
Johannes
Johannes on 13 Feb 2021
Answered: Raynier Suresh on 18 Feb 2021
Hello,
I am currently trying to import a trained ONNX model from Pytorch to Matlab. The exported model works fine in the onnxruntime, but I am a bit confused about the import to Matlab. I allready changed the dimension of the input vector from (25) to (1, 1, 25) to fit an image-like input. Now I get the error:
Error using nnet.internal.cnn.onnx.translateONNX (line 77)
ONNX network with multiple inputs or multiple outputs is not supported when one of the network inputs is
sequential.
Error in nnet.internal.cnn.onnx.importONNXLayers (line 10)
[LayersOrGraph, translationIssues] = nnet.internal.cnn.onnx.translateONNX(modelProto,
OutputLayerType, UserImageInputSize, ImportWeights);
Error in importONNXLayers (line 48)
Layers = nnet.internal.cnn.onnx.importONNXLayers(modelfile, varargin{:});
Error in onnx_to_mat (line 7)
layers = importONNXLayers(modelfile,'ImportWeights',true);
What is the definition of 'sequential' in Matlab? My model is a recurrent GRU model with two inputs (the last hidden state and the input vector). As I want to use the model online in a simulink simulation, my input is always non-sequential (just the vector and the last hidden state). I'll upload a example to reproduce the error.
I addition, here is a visualization of my onnx:
Thanks for your help!

Answers (1)

Raynier Suresh
Raynier Suresh on 18 Feb 2021
Hi, Currently MATLAB does not supports multi input networks with the sequence input layer.I have brought this issue to the concerned people and it might be considered in any future release.
To understand what is a sequential input you can refer this link

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!