ONNX export of RNN / LSTM network

44 次查看(过去 30 天)
Vincent Corlay
Vincent Corlay 2024-11-12,7:08
评论: Vincent Corlay 2024-11-21,23:56
I have a standard LSTM neural network created with the deep learning toolbox.
I export it with the ONNX format with the matlab exportONNXNetwork function.
I then import it via python with onnxruntime: import onnxruntime as ort // session = ort.InferenceSession(onnx_model_path)
Then, when I check session.get_inputs()[0], I see only the data input as unique input. It seems that the states can not be specified. Do you know how to handle the state of the recurrent neural network (especially in closed-loop mode) when using the onnxruntime session.run function?

回答(1 个)

aditi bagora
aditi bagora 2024-11-21,11:21
Since, you have exported the model in ONXX format with the matlab 'exportONNXNetwork' . You can handle the states by defining model outputs ensuring the model outputs the necessary hidden states. To handle these states, update them with the outputs generated from session.run() at each step, feeding them back into the model for subsequent inferences.
  1 个评论
Vincent Corlay
Vincent Corlay 2024-11-21,23:56
"You can handle the states by defining model outputs ensuring the model outputs the necessary hidden states." ==> This should be done in the matlab definition of the RNN?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Image Data Workflows 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by