From 87ce74245776b96d001b452928ff69f55423b5c5 Mon Sep 17 00:00:00 2001 From: Olivier BICHLER <olivier.bichler@cea.fr> Date: Thu, 21 Sep 2023 15:05:56 +0200 Subject: [PATCH] Added missing clone for new MaxPooling_Op --- include/aidge/operator/MaxPooling.hpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/include/aidge/operator/MaxPooling.hpp b/include/aidge/operator/MaxPooling.hpp index 073243e80..49acccc49 100644 --- a/include/aidge/operator/MaxPooling.hpp +++ b/include/aidge/operator/MaxPooling.hpp @@ -63,6 +63,28 @@ public: setDatatype(DataType::Float32); } + /** + * @brief Copy-constructor. Copy the operator parameters and its output tensor(s), but not its input tensors (the new operator has no input associated). + * @param op Operator to copy. + */ + MaxPooling_Op(const MaxPooling_Op& op) + : Operator(Type), + Parameterizable_(op), + mOutput(std::make_shared<Tensor>(*op.mOutput)) + { + // cpy-ctor + setDatatype(op.mOutput->dataType()); + } + + /** + * @brief Clone the operator using its copy-constructor. + * @see Operator::MaxPooling_Op + * @param op Operator to copy. + */ + Operator* clone() const override { + return new MaxPooling_Op<DIM>(*static_cast<const MaxPooling_Op<DIM>*>(this)); + } + constexpr void associateInput(const IOIndex_t inputIdx, std::shared_ptr<Data> data) override final { assert(inputIdx < 1 && "operators supports only 3 inputs"); (void) inputIdx; // avoid unused warning -- GitLab