Repeated scheduler creations lead to unexpected behaviour
Description
I'm attempting to modernize the PTQ implementation and scripts, so that instead of adding an input producer manually, I'd like to pass the tensors directly to the forward method of the scheduler, that is : scheduler.forward(data=[tensor])
During the PTQ, I need to update the scheduler to perform (for example) calibration inferences. I also need to update the scheduler in the test script, in order to perform post quantization inferences.
That is where I'm facing an issue : the re-created scheduler produces wrong schedules, containing only the Producer nodes.
The following code is enough to reproduce this behaviour :
MODEL_NAME, INPUT_SIZE = 'MLP', (1, 1, 28, 28)
# model
aidge_model = aidge_onnx.load_onnx(MODEL_NAME + ".onnx", verbose=False)
aidge_model.set_backend("cpu")
aidge_core.remove_flatten(aidge_model)
# dummy tensor
numpy_tensor = np.random.random(INPUT_SIZE)
aidge_tensor = aidge_core.Tensor(numpy_tensor)
aidge_tensor.set_backend("cpu")
aidge_tensor.set_datatype(aidge_core.DataType.Float32)
# setup
aidge_scheduler = aidge_core.SequentialScheduler(aidge_model)
aidge_scheduler.forward(data=[aidge_tensor])
# setup (bis)
aidge_scheduler = aidge_core.SequentialScheduler(aidge_model)
aidge_scheduler.forward(data=[aidge_tensor])
The first setup is fine, but the second one has an unexpected behaviour ! It produces a warning (remaining consumers ...), output is not updated, and its corresponding schedule contains only the producers.
Note that if I manually attach an input node to the graphview, and call scheduler.forward()
as I used to (without arguments), it works fine for some models, but some others end up in a dead lock.
I'm up to date with dev
for aidge_core.
Edit : If I call resetScheduling()
between the two setups, it works fine for some models, but for some others (for example the ResNet18) it fails and leads to the following log:
Assertion failed: mImpl != nullptr in /data1/is156025/bh277217/workspace/aidge/aidge/aidge_core/src/operator/Operator.cpp:63
resetConsummerProducer(): an implementation is required for PaddedConv!