diff --git a/aidge_backend_cpu/unit_tests/test_scheduler.py b/aidge_backend_cpu/unit_tests/test_scheduler.py index d8cf3e164da4bd34273905b0b0e156cf057635a5..3449ff513ef618e24788419c835b7277a1e751f1 100644 --- a/aidge_backend_cpu/unit_tests/test_scheduler.py +++ b/aidge_backend_cpu/unit_tests/test_scheduler.py @@ -55,6 +55,8 @@ class test_scheduler(unittest.TestCase): graph_view.set_datatype(aidge_core.DataType.Float32) graph_view.set_backend("cpu") + graph_view.forward_dims() + scheduler = aidge_core.SequentialScheduler(graph_view) scheduler.generate_scheduling() @@ -80,6 +82,8 @@ class test_scheduler(unittest.TestCase): graph_view.set_datatype(aidge_core.DataType.Float32) graph_view.set_backend("cpu") + graph_view.forward_dims() + scheduler = aidge_core.SequentialScheduler(graph_view) scheduler.generate_scheduling() diff --git a/include/aidge/backend/cpu/operator/ProducerImpl.hpp b/include/aidge/backend/cpu/operator/ProducerImpl.hpp index 431f11f6ee10946f639691051d80a702a5a43d57..19361f1903e8737562dba63b24f3410e6eba1e5b 100644 --- a/include/aidge/backend/cpu/operator/ProducerImpl.hpp +++ b/include/aidge/backend/cpu/operator/ProducerImpl.hpp @@ -28,7 +28,8 @@ public: return std::make_unique<ProducerImpl_cpu>(op); } - void forward() override {}; + NbElts_t getNbProducedData(const IOIndex_t outputIdx) const override final; + void forward() override; }; namespace { diff --git a/src/operator/ProducerImpl.cpp b/src/operator/ProducerImpl.cpp new file mode 100644 index 0000000000000000000000000000000000000000..404d95ef685fea3c5796e396a2c5e17c60ce53bc --- /dev/null +++ b/src/operator/ProducerImpl.cpp @@ -0,0 +1,34 @@ +/******************************************************************************** + * Copyright (c) 2023 CEA-List + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + * + ********************************************************************************/ + +#include <cassert> +#include <numeric> // std::accumulate +#include <vector> + +#include "aidge/data/Tensor.hpp" +#include "aidge/operator/Producer.hpp" +#include "aidge/utils/Types.h" + +#include "aidge/backend/cpu/operator/ProducerImpl.hpp" + +Aidge::DimSize_t Aidge::ProducerImpl_cpu::getNbProducedData( + Aidge::IOIndex_t outputIdx) const +{ + // Requires the whole tensors, regardless of available data on inputs + assert(outputIdx == 0 && "operator has only one output"); + (void) outputIdx; + + return std::static_pointer_cast<Tensor>(mOp.getOutput(0))->size(); +} + +void Aidge::ProducerImpl_cpu::forward() +{ +}