How to change the dimensions of the original dataset to get the same forecast value? LTSM ONNX
19 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
slevin Lee
el 18 de Nov. de 2022
Respondida: Sivylla Paraskevopoulou
el 18 de Nov. de 2022
I trained an LSTM model in matlab
The original data set is 56 * 3853
feature_dimension is 56
miniBatchSize = 50;
[net,YPred] = predictAndUpdateState(net,xtrain,'ExecutionEnvironment','cpu');
normal operation
then...
filename = "lstm.onnx";
exportONNXNetwork(net,filename)
save data.mat xtrain
in python...
import onnxruntime
onnx_model = onnxruntime.InferenceSession('lstm.onnx')
from scipy import io
mydata = io.loadmat('data.mat')
data=np.float32(mydata['xtrain'])
onnx_input = {onnx_model.get_inputs()[0].name: data}
outputs = onnx_model.run(None, onnx_input)
InvalidArgument: [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Invalid rank for input: input Got: 2 Expected: 3 Please fix either the inputs or the model.
How to change the dimensions of the original dataset to get the same forecast value? LTSM ONNX
thanks a lot !!!
0 comentarios
Respuesta aceptada
Sivylla Paraskevopoulou
el 18 de Nov. de 2022
You should permute from the MATLAB ordering (CN) to the ONNX ordering (NC), where C is the number of features and N is the number of sequence observations. Permute the input data before saving them to data.mat.
xtrain = permute(xtrain,[2,1]);
For more information about dimension ordering for different deep learning platforms, see Input Dimension Ordering.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Sequence and Numeric Feature Data Workflows en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!