diff --git a/include/aidge/operator/Add.hpp b/include/aidge/operator/Add.hpp index 58ff87cf7d79f47ba627f50edd7bff04e9cb8918..3115cedca1f2a3bcc4a1330b96e90669bf7611a2 100644 --- a/include/aidge/operator/Add.hpp +++ b/include/aidge/operator/Add.hpp @@ -47,7 +47,11 @@ public: Add_Op(const Add_Op& op) : OperatorTensor(op) { - mImpl = op.mImpl ? Registrar<Add_Op>::create(op.mOutputs[0]->getImpl()->backend())(*this) : nullptr; + if (op.mImpl){ + SET_IMPL_MACRO(Add_Op, *this, op.mOutputs[0]->getImpl()->backend()); + }else{ + mImpl = nullptr; + } } /** diff --git a/include/aidge/operator/AvgPooling.hpp b/include/aidge/operator/AvgPooling.hpp index 3b84670686e75ac9a26bed41f9dbf0b606535ee5..e427aac72ad3948d0d03f588c930cfccedfb1885 100644 --- a/include/aidge/operator/AvgPooling.hpp +++ b/include/aidge/operator/AvgPooling.hpp @@ -60,7 +60,11 @@ public: : OperatorTensor(op), Attributes_(op) { - mImpl = op.mImpl ? Registrar<AvgPooling_Op<DIM>>::create(op.mOutputs[0]->getImpl()->backend())(*this) : nullptr; + if (op.mImpl){ + SET_IMPL_MACRO(AvgPooling_Op<DIM>, *this, op.mOutputs[0]->getImpl()->backend()); + }else{ + mImpl = nullptr; + } } /** diff --git a/include/aidge/operator/BatchNorm.hpp b/include/aidge/operator/BatchNorm.hpp index 7d57a903327462e331ef0f14e2f09146fab11cc4..83ad2dbbb695e42c11cb794c7d5bd4578056d941 100644 --- a/include/aidge/operator/BatchNorm.hpp +++ b/include/aidge/operator/BatchNorm.hpp @@ -54,7 +54,11 @@ public: : OperatorTensor(op), Attributes_(op) { - mImpl = op.mImpl ? Registrar<BatchNorm_Op<DIM>>::create(op.mOutputs[0]->getImpl()->backend())(*this) : nullptr; + if (op.mImpl){ + SET_IMPL_MACRO(BatchNorm_Op<DIM>, *this, op.mOutputs[0]->getImpl()->backend()); + }else{ + mImpl = nullptr; + } } /** diff --git a/include/aidge/operator/Concat.hpp b/include/aidge/operator/Concat.hpp index 89f113f688628dbb9ac3978edb6c9fa7cd5c295a..450c40bd210e0a4be891e436f03330a984e221be 100644 --- a/include/aidge/operator/Concat.hpp +++ b/include/aidge/operator/Concat.hpp @@ -55,7 +55,11 @@ public: : OperatorTensor(op), Attributes_(op) { - mImpl = op.mImpl ? Registrar<Concat_Op>::create(op.mOutputs[0]->getImpl()->backend())(*this) : nullptr; + if (op.mImpl){ + SET_IMPL_MACRO(Concat_Op, *this, op.mOutputs[0]->getImpl()->backend()); + }else{ + mImpl = nullptr; + } } /** diff --git a/include/aidge/operator/Conv.hpp b/include/aidge/operator/Conv.hpp index 552aee6ba91d6eee4cb3e90a4d35ee55b1c0461c..82cd5df8e24457bd9f5e07c89826904c7d2283ad 100644 --- a/include/aidge/operator/Conv.hpp +++ b/include/aidge/operator/Conv.hpp @@ -65,7 +65,11 @@ public: : OperatorTensor(op), Attributes_(op) { - mImpl = op.mImpl ? Registrar<Conv_Op<DIM>>::create(op.mOutputs[0]->getImpl()->backend())(*this) : nullptr; + if (op.mImpl){ + SET_IMPL_MACRO(Conv_Op<DIM>, *this, op.mOutputs[0]->getImpl()->backend()); + }else{ + mImpl = nullptr; + } } /** diff --git a/include/aidge/operator/ConvDepthWise.hpp b/include/aidge/operator/ConvDepthWise.hpp index b9dabd7e260f1ce518a6ddf297a8b7eb0fbc4dae..7fa9124d4c750cee53d9c4a402a2fa6196ac8158 100644 --- a/include/aidge/operator/ConvDepthWise.hpp +++ b/include/aidge/operator/ConvDepthWise.hpp @@ -67,7 +67,11 @@ public: : OperatorTensor(op), Attributes_(op) { - mImpl = op.mImpl ? Registrar<ConvDepthWise_Op<DIM>>::create(op.mOutputs[0]->getImpl()->backend())(*this) : nullptr; + if (op.mImpl){ + SET_IMPL_MACRO(ConvDepthWise_Op<DIM>, *this, op.mOutputs[0]->getImpl()->backend()); + }else{ + mImpl = nullptr; + } } /** diff --git a/include/aidge/operator/Div.hpp b/include/aidge/operator/Div.hpp index b998e9ee22d69da2e449fe5f7b365284d3c156e6..be654a3c015e5810892c1e23f08cc1f4b83b2d93 100644 --- a/include/aidge/operator/Div.hpp +++ b/include/aidge/operator/Div.hpp @@ -40,7 +40,11 @@ public: Div_Op(const Div_Op& op) : OperatorTensor(op) { - mImpl = op.mImpl ? Registrar<Div_Op>::create(op.mOutputs[0]->getImpl()->backend())(*this) : nullptr; + if (op.mImpl){ + SET_IMPL_MACRO(Div_Op, *this, op.mOutputs[0]->getImpl()->backend()); + }else{ + mImpl = nullptr; + } } /** diff --git a/include/aidge/operator/Erf.hpp b/include/aidge/operator/Erf.hpp index 895d58a8768baf6e20ce2dd34233c57432bdbfed..5a92b5dc45b6a090be0d9306dbfc21b1c0ae6edb 100644 --- a/include/aidge/operator/Erf.hpp +++ b/include/aidge/operator/Erf.hpp @@ -40,7 +40,11 @@ public: Erf_Op(const Erf_Op& op) : OperatorTensor(op) { - mImpl = op.mImpl ? Registrar<Erf_Op>::create(mOutputs[0]->getImpl()->backend())(*this) : nullptr; + if (op.mImpl){ + SET_IMPL_MACRO(Erf_Op, *this, op.mOutputs[0]->getImpl()->backend()); + }else{ + mImpl = nullptr; + } } /** diff --git a/include/aidge/operator/FC.hpp b/include/aidge/operator/FC.hpp index 3e4ffabc2054332cd26450beabdaa7cfec829b24..c111e38b00e69c8d0aecd9df0023f07a47a3865d 100644 --- a/include/aidge/operator/FC.hpp +++ b/include/aidge/operator/FC.hpp @@ -57,7 +57,11 @@ public: : OperatorTensor(op), Attributes_(op) { - mImpl = op.mImpl ? Registrar<FC_Op>::create(op.mOutputs[0]->getImpl()->backend())(*this) : nullptr; + if (op.mImpl){ + SET_IMPL_MACRO(FC_Op, *this, op.mOutputs[0]->getImpl()->backend()); + }else{ + mImpl = nullptr; + } } /** diff --git a/include/aidge/operator/Gather.hpp b/include/aidge/operator/Gather.hpp index 1e5957e8360004abddf82a71a46ba1bfbc58a1ef..142f6582a3afbc85ccd951fcfeff2a924a35e718 100644 --- a/include/aidge/operator/Gather.hpp +++ b/include/aidge/operator/Gather.hpp @@ -58,7 +58,11 @@ public: : OperatorTensor(op), Attributes_(op) { - mImpl = op.mImpl ? Registrar<Gather_Op>::create(mOutputs[0]->getImpl()->backend())(*this) : nullptr; + if (op.mImpl){ + SET_IMPL_MACRO(Gather_Op, *this, op.mOutputs[0]->getImpl()->backend()); + }else{ + mImpl = nullptr; + } } /** diff --git a/include/aidge/operator/LeakyReLU.hpp b/include/aidge/operator/LeakyReLU.hpp index d0fd2733ac49744046248ddd7f138a791a1563a1..c48b85b4a7af71fde0f8136732597e098c966839 100644 --- a/include/aidge/operator/LeakyReLU.hpp +++ b/include/aidge/operator/LeakyReLU.hpp @@ -54,7 +54,11 @@ public: : OperatorTensor(op), Attributes_(op) { - mImpl = op.mImpl ? Registrar<LeakyReLU_Op>::create(op.mOutputs[0]->getImpl()->backend())(*this) : nullptr; + if (op.mImpl){ + SET_IMPL_MACRO(LeakyReLU_Op, *this, op.mOutputs[0]->getImpl()->backend()); + }else{ + mImpl = nullptr; + } } /** @@ -68,7 +72,6 @@ public: void setBackend(const std::string& name, DeviceIdx_t device = 0) override { - mImpl = Registrar<LeakyReLU_Op>::create(name)(*this); SET_IMPL_MACRO(LeakyReLU_Op, *this, name); mOutputs[0]->setBackend(name, device); } diff --git a/include/aidge/operator/MaxPooling.hpp b/include/aidge/operator/MaxPooling.hpp index a256758f9f7b2f102bfee8b1be0b0dcef4cb4c12..06ac30158f80a946b9310a93c8f81cc3ee975c84 100644 --- a/include/aidge/operator/MaxPooling.hpp +++ b/include/aidge/operator/MaxPooling.hpp @@ -64,7 +64,11 @@ public: : OperatorTensor(op), Attributes_(op) { - mImpl = op.mImpl ? Registrar<MaxPooling_Op<DIM>>::create(op.mOutputs[0]->getImpl()->backend())(*this) : nullptr; + if (op.mImpl){ + SET_IMPL_MACRO(MaxPooling_Op<DIM>, *this, op.mOutputs[0]->getImpl()->backend()); + }else{ + mImpl = nullptr; + } } /** diff --git a/include/aidge/operator/Move.hpp b/include/aidge/operator/Move.hpp index 62fb9897384673c695895b54557b4cf637aa2447..2db7d49af979f8497c5853cc8e39947c9ba7ea7e 100644 --- a/include/aidge/operator/Move.hpp +++ b/include/aidge/operator/Move.hpp @@ -39,7 +39,11 @@ public: Move_Op(const Move_Op& op) : OperatorTensor(op) { - mImpl = op.mImpl ? Registrar<Move_Op>::create({mInputs[0]->getImpl()->backend(), mOutputs[0]->getImpl()->backend()})(*this) : nullptr; + if (op.mImpl){ + SET_IMPL_MACRO(Move_Op, *this, op.mOutputs[0]->getImpl()->backend()); + }else{ + mImpl = nullptr; + } } /** @@ -72,4 +76,4 @@ inline std::shared_ptr<Node> Move(const std::string& name = "") { } } -#endif /* AIDGE_CORE_OPERATOR_MOVE_H_ */ \ No newline at end of file +#endif /* AIDGE_CORE_OPERATOR_MOVE_H_ */ diff --git a/include/aidge/operator/Pow.hpp b/include/aidge/operator/Pow.hpp index e8894d1a2418402e4087bbfda07b98ad0cb1d1fc..ec4eebf9ddba475310ba292dd5923ba50933545d 100644 --- a/include/aidge/operator/Pow.hpp +++ b/include/aidge/operator/Pow.hpp @@ -40,7 +40,11 @@ public: Pow_Op(const Pow_Op& op) : OperatorTensor(op) { - mImpl = op.mImpl ? Registrar<Pow_Op>::create(op.mOutputs[0]->getImpl()->backend())(*this) : nullptr; + if (op.mImpl){ + SET_IMPL_MACRO(Pow_Op, *this, op.mOutputs[0]->getImpl()->backend()); + }else{ + mImpl = nullptr; + } } /** diff --git a/include/aidge/operator/Producer.hpp b/include/aidge/operator/Producer.hpp index 29fada1c5a0eea2a47f4a6921d4ec3dd2d069094..f085474a8d2fcc218e319ed2f9c1883cc27373b9 100644 --- a/include/aidge/operator/Producer.hpp +++ b/include/aidge/operator/Producer.hpp @@ -67,9 +67,11 @@ public: for (std::size_t i = 0; i < static_cast<std::size_t>(nbOutputs()); ++i) { mOutputs[i] = std::make_shared<Tensor>(*(op.getOutput(i))); } - mImpl = (mOutputs[0]->getImpl() && Registrar<Producer_Op>::exists({mOutputs[0]->getImpl()->backend()})) - ? Registrar<Producer_Op>::create(mOutputs[0]->getImpl()->backend())(*this) - : std::make_shared<OperatorImpl>(*this); + if (op.mImpl){ + SET_IMPL_MACRO(Producer_Op, *this, op.mOutputs[0]->getImpl()->backend()); + }else{ + mImpl = nullptr; + } } /** diff --git a/include/aidge/operator/ReLU.hpp b/include/aidge/operator/ReLU.hpp index 7a5144f48e38777801fcf1082c05c488e734f492..5b8f5c4b819f9a2f8cf518bdc50c445fbce38102 100644 --- a/include/aidge/operator/ReLU.hpp +++ b/include/aidge/operator/ReLU.hpp @@ -39,7 +39,11 @@ public: ReLU_Op(const ReLU_Op& op) : OperatorTensor(op) { - mImpl = op.mImpl ? Registrar<ReLU_Op>::create(op.mOutputs[0]->getImpl()->backend())(*this) : nullptr; + if (op.mImpl){ + SET_IMPL_MACRO(ReLU_Op, *this, op.mOutputs[0]->getImpl()->backend()); + }else{ + mImpl = nullptr; + } } /** diff --git a/include/aidge/operator/ReduceMean.hpp b/include/aidge/operator/ReduceMean.hpp index 70fe036351f38e44b10b66564a9bfe24aa4b89d1..09f1d58359b265af58fd78ef8de54dd1944b5cf1 100644 --- a/include/aidge/operator/ReduceMean.hpp +++ b/include/aidge/operator/ReduceMean.hpp @@ -57,7 +57,11 @@ class ReduceMean_Op : public OperatorTensor, : OperatorTensor(op), Attributes_(op) { - mImpl = op.mImpl ? Registrar<ReduceMean_Op<DIM>>::create(mOutputs[0]->getImpl()->backend())(*this) : nullptr; + if (op.mImpl){ + SET_IMPL_MACRO(ReduceMean_Op<DIM>, *this, op.mOutputs[0]->getImpl()->backend()); + }else{ + mImpl = nullptr; + } } /** diff --git a/include/aidge/operator/Reshape.hpp b/include/aidge/operator/Reshape.hpp index 410f55e5bbad43e294ae942d68fc2543449373b1..8914bbc9a9f3748276ead32aba8cb023ba14b1b7 100644 --- a/include/aidge/operator/Reshape.hpp +++ b/include/aidge/operator/Reshape.hpp @@ -53,7 +53,11 @@ public: : OperatorTensor(op), Attributes_(op) { - mImpl = op.mImpl ? Registrar<Reshape_Op>::create(mOutputs[0]->getImpl()->backend())(*this) : nullptr; + if (op.mImpl){ + SET_IMPL_MACRO(Reshape_Op, *this, op.mOutputs[0]->getImpl()->backend()); + }else{ + mImpl = nullptr; + } } /** diff --git a/include/aidge/operator/Scaling.hpp b/include/aidge/operator/Scaling.hpp index 54f1d98d2f61d18dd821c9f0a6b574bb52b0c9f0..ad4b027ceb3084fc7d9f0f21079df8a72ad7cdef 100644 --- a/include/aidge/operator/Scaling.hpp +++ b/include/aidge/operator/Scaling.hpp @@ -55,7 +55,11 @@ public: : OperatorTensor(op), Attributes_(op) { - mImpl = op.mImpl ? Registrar<Scaling_Op>::create(op.mOutputs[0]->getImpl()->backend())(*this) : nullptr; + if (op.mImpl){ + SET_IMPL_MACRO(Reshape_Op, *this, op.mOutputs[0]->getImpl()->backend()); + } else { + mImpl = nullptr; + } } /** @@ -95,4 +99,4 @@ const char* const EnumStrings<Aidge::ScalingAttr>::data[] = {"scalingFactor", "quantizedNbBits", "isOutputUnsigned"}; } -#endif /* __AIDGE_CORE_OPERATOR_RELU_H__ */ \ No newline at end of file +#endif /* __AIDGE_CORE_OPERATOR_RELU_H__ */ diff --git a/include/aidge/operator/Slice.hpp b/include/aidge/operator/Slice.hpp index 3635eb32c3e26195d4cf9979f3213f0bba487134..363c3c2b4ec397fdd62dc3260b63a0cd6d6c0081 100644 --- a/include/aidge/operator/Slice.hpp +++ b/include/aidge/operator/Slice.hpp @@ -55,8 +55,11 @@ public: : OperatorTensor(op), Attributes_(op) { - mImpl = op.mImpl ? Registrar<Slice_Op>::create(op.mOutputs[0]->getImpl()->backend())(*this) - : nullptr; + if (op.mImpl){ + SET_IMPL_MACRO(Slice_Op, *this, op.mOutputs[0]->getImpl()->backend()); + }else{ + mImpl = nullptr; + } } public: diff --git a/include/aidge/operator/Softmax.hpp b/include/aidge/operator/Softmax.hpp index a63827a858233b7f73a186efb0c4ee1bf5a340cf..943f69a588ebfedf28ec5ebb3a782e7510fa710a 100644 --- a/include/aidge/operator/Softmax.hpp +++ b/include/aidge/operator/Softmax.hpp @@ -55,7 +55,11 @@ public: : OperatorTensor(op), Attributes_(op) { - mImpl = op.mImpl ? Registrar<Softmax_Op>::create(op.mOutputs[0]->getImpl()->backend())(*this) : nullptr; + if (op.mImpl){ + SET_IMPL_MACRO(Softmax_Op, *this, op.mOutputs[0]->getImpl()->backend()); + }else{ + mImpl = nullptr; + } } /** diff --git a/include/aidge/operator/Sqrt.hpp b/include/aidge/operator/Sqrt.hpp index 69a1ffba967067cd998e797a75a9ab3958a51988..dd3fa541b9fd5177ddd3b9e8bcd781c0ea3a1867 100644 --- a/include/aidge/operator/Sqrt.hpp +++ b/include/aidge/operator/Sqrt.hpp @@ -45,7 +45,11 @@ public: Sqrt_Op(const Sqrt_Op& op) : OperatorTensor(op) { - mImpl = op.mImpl ? Registrar<Sqrt_Op>::create(op.mOutputs[0]->getImpl()->backend())(*this) : nullptr; + if (op.mImpl){ + SET_IMPL_MACRO(Sqrt_Op, *this, op.mOutputs[0]->getImpl()->backend()); + }else{ + mImpl = nullptr; + } } /** diff --git a/include/aidge/operator/Sub.hpp b/include/aidge/operator/Sub.hpp index 721b68a44f813cd72fa3d62dc18b545a31bfc4a6..5683a9be5ea2278d92fe7da081f0c4a80ff9500d 100644 --- a/include/aidge/operator/Sub.hpp +++ b/include/aidge/operator/Sub.hpp @@ -45,7 +45,11 @@ public: Sub_Op(const Sub_Op& op) : OperatorTensor(op) { - mImpl = op.mImpl ? Registrar<Sub_Op>::create(op.mOutputs[0]->getImpl()->backend())(*this) : nullptr; + if (op.mImpl){ + SET_IMPL_MACRO(Sub_Op, *this, op.mOutputs[0]->getImpl()->backend()); + }else{ + mImpl = nullptr; + } } /** diff --git a/include/aidge/operator/Transpose.hpp b/include/aidge/operator/Transpose.hpp index f081f830aa0d98ab6aa60f0632939010367b790d..b040fc907dd5ac1f40a8a1885d27364785ba9188 100644 --- a/include/aidge/operator/Transpose.hpp +++ b/include/aidge/operator/Transpose.hpp @@ -56,7 +56,11 @@ class Transpose_Op : public OperatorTensor, : OperatorTensor(op), Attributes_(op) { - mImpl = op.mImpl ? Registrar<Transpose_Op<DIM>>::create(mOutputs[0]->getImpl()->backend())(*this) : nullptr; + if (op.mImpl){ + SET_IMPL_MACRO(Transpose_Op<DIM>, *this, op.mOutputs[0]->getImpl()->backend()); + }else{ + mImpl = nullptr; + } } /**