필터 지우기
필터 지우기

LSTM architecture for a sequence-to-sequence model

조회 수: 1 (최근 30일)
Brita Linnestad
Brita Linnestad 2022년 9월 28일
답변: Sivylla Paraskevopoulou 2022년 10월 14일
I have build a LSTM sequence-to-sequence model which I would like to convert to onnx and use in a python script-
My input data is as follows, 11307 sequences of 24 times steps and 6 features:
XTrain = 11307x1 cell array
{ 6x24 double}
YTrain = 11307x1 cell array
{1x24 catgorical}
The layer is :
numFeatures = 6
NumHiddenUnis = 50
numClasses = 2
layers = [ ...
sequenceInputLayer(numFeatures)
lstmLayer(numHiddenUnits,'OutputMode','sequence')
fullyConnectedLayer(numClasses)
softmaxLayer
classificationLayer];
netlstm=trainNetwork(XTrain,YTrain,layers,options)
Whe I run the model on test data with numFeatures = 6, sequence_length = 24 in matlab, the results are good.
Exporting netlstm to onnx using
exportONNXNetwork(netlstm, 'file.onnx')
Viewing the file.onnx in a model checker show that the initial_h is 1x1x50, not 1x24x50 as expected.
Loading the onnx.model in python, I can run the model with input 1x1x6, but not he full sequence of 24 time steps.
Why is the sequnce length missing from initial_h after exporting to onnx?
gives the same issue when exporting the network after running the example.

답변 (1개)

Sivylla Paraskevopoulou
Sivylla Paraskevopoulou 2022년 10월 14일
You can try specifying the BatchSize name-value argument of the exportONNXNetwork function.

카테고리

Help CenterFile Exchange에서 Predictive Maintenance Toolbox에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by