diff --git a/include/aidge/operator/MaxPooling.hpp b/include/aidge/operator/MaxPooling.hpp index 073243e801c6e1297129424b0c93b1a7c4f112f3..49acccc49cce7ad1af1dd4b53babd84760e0e68a 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