diff --git a/include/aidge/operator/MetaOperator.hpp b/include/aidge/operator/MetaOperator.hpp index 63ca56d0b70aefc00280647f99de03c2916a3615..cbc9cc1180ee0d7ec2d82ad37abc2ec4f1c945d7 100644 --- a/include/aidge/operator/MetaOperator.hpp +++ b/include/aidge/operator/MetaOperator.hpp @@ -122,7 +122,13 @@ public: * @param data Shared pointer to the data tensor. */ void setInput(const IOIndex_t inputIdx, const std::shared_ptr<Data>& data) override final; - + + /** + * @brief Resets the input tensor at a given index. + * @param[in] inputIdx Index of the input to reset. + */ + void resetInput(const IOIndex_t inputIdx) override; + /** * @brief Forward the dimensions through the micro-graph. * diff --git a/include/aidge/operator/OperatorTensor.hpp b/include/aidge/operator/OperatorTensor.hpp index 0e3d275eb73c8024af233a7c4406b0dbaf0e43ca..1b2035222d18eaec043d770f36806da922370f87 100644 --- a/include/aidge/operator/OperatorTensor.hpp +++ b/include/aidge/operator/OperatorTensor.hpp @@ -94,7 +94,7 @@ public: * @brief Resets the input tensor at a given index. * @param[in] inputIdx Index of the input to reset. */ - void resetInput(const IOIndex_t inputIdx) override final; + virtual void resetInput(const IOIndex_t inputIdx) override; /////////////////////////////////////////////////// /////////////////////////////////////////////////// diff --git a/src/operator/MetaOperator.cpp b/src/operator/MetaOperator.cpp index 192cc9f5e272f8bb0f718e1dfb2a1100c05a72d1..939c7bb236f4334bf3b5e61bc45fef185494920f 100644 --- a/src/operator/MetaOperator.cpp +++ b/src/operator/MetaOperator.cpp @@ -106,6 +106,14 @@ void Aidge::MetaOperator_Op::setInput(const Aidge::IOIndex_t inputIdx, const std mInputs[inputIdx] = std::dynamic_pointer_cast<Tensor>(inputOp.first->getOperator()->getRawInput(inputOp.second)); } +void Aidge::MetaOperator_Op::resetInput(const Aidge::IOIndex_t inputIdx) { + const auto& inputOp = mGraph->getOrderedInputs()[inputIdx]; + AIDGE_ASSERT(inputIdx < inputOp.first->nbInputs(), "Input idx out of range."); + inputOp.first->getOperator()->resetInput(inputIdx); + + mInputs[inputIdx] = std::dynamic_pointer_cast<Tensor>(inputOp.first->getOperator()->getRawInput(inputOp.second)); +} + std::string Aidge::MetaOperator_Op::backend() const noexcept { return (mImpl) ? mImpl->backend()