diff --git a/include/aidge/operator/MetaOperator.hpp b/include/aidge/operator/MetaOperator.hpp index c6ab45290265617850c01bb00abd7f972cd3525c..63ca56d0b70aefc00280647f99de03c2916a3615 100644 --- a/include/aidge/operator/MetaOperator.hpp +++ b/include/aidge/operator/MetaOperator.hpp @@ -203,13 +203,8 @@ public: /** * @brief Perform the backward pass for the operator. - * - * @note Currently not implemented. */ - void backward() override { - AIDGE_THROW_OR_ABORT(std::runtime_error, "backward() not implemented yet for a MetaOperator"); - } - + void backward() override; /** * @brief Check if the operator is atomic. * diff --git a/src/operator/MetaOperator.cpp b/src/operator/MetaOperator.cpp index 96c5b219a35a32fb9574eda1a36a8fa4ee502cc4..a7d2a1da8e67d4b10c5fb49b6eeb491c0942a2f3 100644 --- a/src/operator/MetaOperator.cpp +++ b/src/operator/MetaOperator.cpp @@ -273,6 +273,21 @@ void Aidge::MetaOperator_Op::forward() { } } +void Aidge::MetaOperator_Op::backward() { + if (mImpl) { + // A custom implementation exists for this meta operator + mImpl->backward(); + } + else { + // No custom implementation, use the individual operators implementations + if (!mScheduler) { + mScheduler = std::make_shared<SequentialScheduler>(mGraph, mUpperNode.lock()); + mScheduler->generateScheduling(); + } + mScheduler->backward(); + } +} + ///////////////////////////////////////////////// std::shared_ptr<Aidge::Node> Aidge::MetaOperator(const char *type,