Convert learning model .onnx to pytorch and use it by matlab engine

Hi all, I meet a problem. There is a learning model .onnx. It can be used in Matlab and it can be loaded in python. For some reasons, I need to use matlab engine in python. The learning model .onnx can not be used in python by matlab engine. The matlab function call is ‘predictAndUpdateState’(required deep learning tool box),
The python script looks like:
import onnx
import matlab.engine

matlab_engine = matlab.engine.start_matlab()
learning_model = onnx.load(‘XXX.onnx’)
[learning_model, ans ] = matlab_engine.predictAndUpdateState(learning_model, input)

the error is 'unsupported Python data type: onnx.onnx_ml_pb2.ModelProto"
So, what should I do?

This issue doesn’t seem to be PyTorch-related so I would recommend to post the question in a MATLAB or ONNX - specific discussion board.

thank you, Do you know that does the Pytorch has the same function as matlab learning function ‘predictAndUpdateState’ ?

No, PyTorch does not have a predictAndUpdateState function, but based on its name I would guess it triggers a full training iteration.
In this case you could write the actual training loop as seen here or wrap it additionally in another function.

Okay, thank you. I will try