Unable to forwardDims() of lstm Operator
I am trying to test inference of an lstm_model.onnx.
The model has 6 inputs :
- W, R, B and initial_h as initializers
- X and initial_c as dynamic inputs
I am using this script to test the model on Aidge:
import aidge_core
import aidge_backend_cpu
import aidge_onnx
import numpy as np
aidge_model = aidge_onnx.load_onnx('lstm_model.onnx')
input_x = np.random.randn(sequence_length, batch_size, input_size).astype(np.float32)
input_tensor = aidge_core.Tensor(input_x)
input_node = aidge_core.Producer(input_tensor, "X")
input_node.get_operator().set_datatype(aidge_core.dtype.float32)
input_node.get_operator().set_backend("cpu")
input_node.add_child(aidge_model, 0, aidge_model.get_ordered_inputs()[0])
aidge_model.add(input_node)
input_initial_c = np.random.randn(num_directions, batch_size, hidden_size).astype(np.float32)
input_tensor2 = aidge_core.Tensor(input_initial_c)
input_node2 = aidge_core.Producer(input_tensor2, "initial_c")
input_node2.get_operator().set_datatype(aidge_core.dtype.float32)
input_node2.get_operator().set_backend("cpu")
input_node2.add_child(aidge_model, 0, aidge_model.get_ordered_inputs()[1])
aidge_model.add(input_node2)
aidge_model.set_datatype(aidge_core.dtype.float32)
aidge_model.set_backend("cpu")
scheduler = aidge_core.SequentialScheduler(aidge_model)
scheduler.forward()
I am getting a segmentation fault in Aidge::GraphView::forwardDims
:
https://gitlab.eclipse.org/eclipse/aidge/aidge_core/-/blob/dev/src/graph/GraphView.cpp?ref_type=heads#L502
nodePtr
is a null pointer.
when I tried to change the condition in the if to:
if (nodePtr && nodePtr->getOperator()->operatorType() == OperatorType::Tensor)
I get another error later:
Assertion failed: (getInput(1)->nbDims() == 2) in /tmp/pip-req-build-cckhbi1f/src/operator/FC.cpp:46
Wrong weight Tensor dimension: 3 for FC operator (should have 2 dimensions).
Edited by Houssem ROUIS