Skip to content
Snippets Groups Projects
Commit 790cc0d0 authored by Maxence Naud's avatar Maxence Naud
Browse files

[Add] clone function to Scaling

parent cae06e01
No related branches found
No related tags found
1 merge request!8GraphView cloning proposal + labelGraph proof of concept
Pipeline #32103 passed
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment