diff --git a/include/aidge/operator/Scaling.hpp b/include/aidge/operator/Scaling.hpp index e158ecd7567eb683558d9e09a6cf03e5cc35ce42..a2b4091844e545d7d31d97d47def62c41ba14379 100644 --- a/include/aidge/operator/Scaling.hpp +++ b/include/aidge/operator/Scaling.hpp @@ -55,6 +55,27 @@ 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. + */ + Scaling_Op(const Scaling_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::Scaling_Op + */ + std::shared_ptr<Operator> clone() const override { + return std::make_shared<Scaling_Op>(*this); + } + void associateInput(const IOIndex_t inputIdx, std::shared_ptr<Data> data) override final { assert(inputIdx == 0 && "operator supports only 1 input"); assert(strcmp(data->type(), Tensor::Type)==0 && "input data must be of Tensor type"); @@ -84,7 +105,7 @@ public: } - inline std::shared_ptr<Tensor> getInput(const IOIndex_t inputIdx) const override final { + inline std::shared_ptr<Tensor> getInput(const IOIndex_t inputIdx) const override final { assert((inputIdx == 0) && "Scaling Operator has only 1 input"); (void) inputIdx; // avoid unused warning return mInput;