diff --git a/include/aidge/data/Tensor.hpp b/include/aidge/data/Tensor.hpp index 3ee64cecaf9b139ec0a7ef9a0fa4acc5b06f57c7..f8b1c88122d61f7d4d5ecfd24b612887ceacbbc0 100644 --- a/include/aidge/data/Tensor.hpp +++ b/include/aidge/data/Tensor.hpp @@ -36,7 +36,7 @@ namespace Aidge { * Contains a pointer to an actual contiguous implementation of data. */ class Tensor : public Data, - public Registrable<Tensor, std::tuple<std::string, DataType>, std::shared_ptr<TensorImpl>(DeviceIdx_t device, std::vector<DimSize_t> dims)> { + public Registrable<Tensor, std::tuple<std::string, DataType>, std::function<std::shared_ptr<TensorImpl>(DeviceIdx_t device, std::vector<DimSize_t> dims)>> { private: DataType mDataType = DataType::Float32; /** enum to specify data type. */ DataFormat mDataFormat = DataFormat::Default; /** enum to specify data format. */ diff --git a/include/aidge/hook/Hook.hpp b/include/aidge/hook/Hook.hpp index 5e00db5d68f11aadd4f3b6eb8174ba61b33e4a49..5edf231d51f913f58351b4817e145b5f48953ddd 100644 --- a/include/aidge/hook/Hook.hpp +++ b/include/aidge/hook/Hook.hpp @@ -24,8 +24,8 @@ namespace Aidge { class Operator; -class Hook : public Registrable<Hook, std::tuple<std::string>, std::shared_ptr<Hook>(const std::shared_ptr<Operator>)> { -//class Hook : public Registrable<Hook, std::tuple<std::string>, std::shared_ptr<Hook>(const std::shared_ptr<Operator>)>{ +class Hook : public Registrable<Hook, std::tuple<std::string>, std::function<std::shared_ptr<Hook>(const std::shared_ptr<Operator>)>> { +//class Hook : public Registrable<Hook, std::tuple<std::string>, std::function<std::shared_ptr<Hook>(const std::shared_ptr<Operator>)>>{ protected: const std::shared_ptr<Operator> mOperator; diff --git a/include/aidge/operator/Add.hpp b/include/aidge/operator/Add.hpp index 97db476729abc07985b16de62084be5fce603bc9..b35a019235ea606b21322f05dd2684eec2e7e5d0 100644 --- a/include/aidge/operator/Add.hpp +++ b/include/aidge/operator/Add.hpp @@ -24,7 +24,7 @@ namespace Aidge { class Add_Op : public OperatorTensor, - public Registrable<Add_Op, std::string, std::shared_ptr<OperatorImpl>(const Add_Op&)> { + public Registrable<Add_Op, std::string, std::function<std::shared_ptr<OperatorImpl>(const Add_Op&)>> { public: static const std::string Type; diff --git a/include/aidge/operator/AvgPooling.hpp b/include/aidge/operator/AvgPooling.hpp index b2f4ce92580afddcc7aa3627ea0ef89d4ac3ffee..6fc7b596aa5f7e4ea13e071acfb6c3faa4fc6ea3 100644 --- a/include/aidge/operator/AvgPooling.hpp +++ b/include/aidge/operator/AvgPooling.hpp @@ -28,7 +28,7 @@ enum class AvgPoolingAttr { StrideDims, KernelDims }; template <DimIdx_t DIM> class AvgPooling_Op : public OperatorTensor, - public Registrable<AvgPooling_Op<DIM>, std::string, std::shared_ptr<OperatorImpl>(const AvgPooling_Op<DIM> &)> { + public Registrable<AvgPooling_Op<DIM>, std::string, std::function<std::shared_ptr<OperatorImpl>(const AvgPooling_Op<DIM> &)>> { public: static const std::string Type; diff --git a/include/aidge/operator/BatchNorm.hpp b/include/aidge/operator/BatchNorm.hpp index 7f1f63c68a512c4b6a59a515d6130afe9696a8c2..f09b52de403b59c9c41d2064ddf0033af1d6dbed 100644 --- a/include/aidge/operator/BatchNorm.hpp +++ b/include/aidge/operator/BatchNorm.hpp @@ -28,7 +28,7 @@ enum class BatchNormAttr { Epsilon, Momentum }; template <DimIdx_t DIM> class BatchNorm_Op : public OperatorTensor, - public Registrable<BatchNorm_Op<DIM>, std::string, std::shared_ptr<OperatorImpl>(const BatchNorm_Op<DIM> &)> { + public Registrable<BatchNorm_Op<DIM>, std::string, std::function<std::shared_ptr<OperatorImpl>(const BatchNorm_Op<DIM> &)>> { public: static const std::string Type; diff --git a/include/aidge/operator/Cast.hpp b/include/aidge/operator/Cast.hpp index fd12f551a2251f3dfe8ea0a0d0528d9dad742e42..58969c0e196c2aa3a7e86c957c7b75bbf664c0a6 100644 --- a/include/aidge/operator/Cast.hpp +++ b/include/aidge/operator/Cast.hpp @@ -33,7 +33,7 @@ public: enum class CastAttr { TargetType }; class Cast_Op : public OperatorTensor, - public Registrable<Cast_Op, std::string, std::unique_ptr<OperatorImpl>(const Cast_Op&)> { + public Registrable<Cast_Op, std::string, std::function<std::unique_ptr<OperatorImpl>(const Cast_Op&)>> { public: static const std::string Type; diff --git a/include/aidge/operator/Concat.hpp b/include/aidge/operator/Concat.hpp index 46cd3a5a328984bde7e537d984b30e0774a3d259..97db803c62f4302a3a061cce9bd92ec7252bb993 100644 --- a/include/aidge/operator/Concat.hpp +++ b/include/aidge/operator/Concat.hpp @@ -37,7 +37,7 @@ public: enum class ConcatAttr { Axis }; class Concat_Op : public OperatorTensor, - public Registrable<Concat_Op, std::string, std::shared_ptr<OperatorImpl>(const Concat_Op&)> { + public Registrable<Concat_Op, std::string, std::function<std::shared_ptr<OperatorImpl>(const Concat_Op&)>> { public: static const std::string Type; diff --git a/include/aidge/operator/Conv.hpp b/include/aidge/operator/Conv.hpp index 7366472d24b78b58aab589ea2b3ccd045e4a5ea7..1a32b14b87eae4d435507fc17b94db11cd011953 100644 --- a/include/aidge/operator/Conv.hpp +++ b/include/aidge/operator/Conv.hpp @@ -34,7 +34,7 @@ enum class ConvAttr { StrideDims, DilationDims, KernelDims }; template <DimIdx_t DIM> class Conv_Op : public OperatorTensor, - public Registrable<Conv_Op<DIM>, std::string, std::shared_ptr<OperatorImpl>(const Conv_Op<DIM> &)> { + public Registrable<Conv_Op<DIM>, std::string, std::function<std::shared_ptr<OperatorImpl>(const Conv_Op<DIM> &)>> { public: static const std::string Type; diff --git a/include/aidge/operator/ConvDepthWise.hpp b/include/aidge/operator/ConvDepthWise.hpp index 63d8e8419b47279c51783db057b5b1a63c7d0884..a4665239f1f1a59d8efa0bdafb766cfa71fb80aa 100644 --- a/include/aidge/operator/ConvDepthWise.hpp +++ b/include/aidge/operator/ConvDepthWise.hpp @@ -33,7 +33,7 @@ enum class ConvDepthWiseAttr { StrideDims, DilationDims, KernelDims }; template <DimIdx_t DIM> class ConvDepthWise_Op : public OperatorTensor, - public Registrable<ConvDepthWise_Op<DIM>, std::string, std::shared_ptr<OperatorImpl>(const ConvDepthWise_Op<DIM> &)> { + public Registrable<ConvDepthWise_Op<DIM>, std::string, std::function<std::shared_ptr<OperatorImpl>(const ConvDepthWise_Op<DIM> &)>> { public: static const std::string Type; diff --git a/include/aidge/operator/Div.hpp b/include/aidge/operator/Div.hpp index b16a5e6733e8846b05e3e491cf5bc7f793d97f1c..22fed0371d0e414adac24b9fcc89bfbeff4f2e1a 100644 --- a/include/aidge/operator/Div.hpp +++ b/include/aidge/operator/Div.hpp @@ -25,7 +25,7 @@ namespace Aidge { class Div_Op : public OperatorTensor, - public Registrable<Div_Op, std::string, std::shared_ptr<OperatorImpl>(const Div_Op&)> { + public Registrable<Div_Op, std::string, std::function<std::shared_ptr<OperatorImpl>(const Div_Op&)>> { public: static const std::string Type; diff --git a/include/aidge/operator/Erf.hpp b/include/aidge/operator/Erf.hpp index b6cc8f30c0fff3366cb1d3fea678e4cad8f9cb10..b5c4d80bcadb8b8d8c47c1bfb11def860598ff3a 100644 --- a/include/aidge/operator/Erf.hpp +++ b/include/aidge/operator/Erf.hpp @@ -25,7 +25,7 @@ namespace Aidge { class Erf_Op : public OperatorTensor, - public Registrable<Erf_Op, std::string, std::shared_ptr<OperatorImpl>(const Erf_Op&)> { + public Registrable<Erf_Op, std::string, std::function<std::shared_ptr<OperatorImpl>(const Erf_Op&)>> { public: static const std::string Type; diff --git a/include/aidge/operator/FC.hpp b/include/aidge/operator/FC.hpp index f1996fbae025838e2e6f6c21c70018c7cc9746f5..cfd2747a7bb96ac0c5a7e1c9e219fdd768aefe88 100644 --- a/include/aidge/operator/FC.hpp +++ b/include/aidge/operator/FC.hpp @@ -27,7 +27,7 @@ namespace Aidge { class FC_Op : public OperatorTensor, public Registrable<FC_Op, std::string, - std::shared_ptr<OperatorImpl>(const FC_Op &)> { + std::function<std::shared_ptr<OperatorImpl>(const FC_Op &)>> { public: static const std::string Type; diff --git a/include/aidge/operator/Fold.hpp b/include/aidge/operator/Fold.hpp index aebe3879b94fd13c8226fffe42e513715d8e3e5a..bbf838b0b7e8b450c4c964f7177c2bf9bb3da7cd 100644 --- a/include/aidge/operator/Fold.hpp +++ b/include/aidge/operator/Fold.hpp @@ -34,7 +34,7 @@ enum class FoldAttr { OutputDims, StrideDims, DilationDims, KernelDims }; template <DimIdx_t DIM> class Fold_Op : public OperatorTensor, - public Registrable<Fold_Op<DIM>, std::string, std::shared_ptr<OperatorImpl>(const Fold_Op<DIM> &)> { + public Registrable<Fold_Op<DIM>, std::string, std::function<std::shared_ptr<OperatorImpl>(const Fold_Op<DIM> &)>> { public: static const std::string Type; diff --git a/include/aidge/operator/Gather.hpp b/include/aidge/operator/Gather.hpp index f2e3b0fe8c063a5eec5e0c2140c3b7eabf3ee68a..2122e89ac4718edaad76854630c931e91d94d8c4 100644 --- a/include/aidge/operator/Gather.hpp +++ b/include/aidge/operator/Gather.hpp @@ -36,7 +36,7 @@ enum class GatherAttr { Axis, Indices, GatheredShape }; class Gather_Op : public OperatorTensor, public Registrable<Gather_Op, std::string, - std::shared_ptr<OperatorImpl>(const Gather_Op&)> { + std::function<std::shared_ptr<OperatorImpl>(const Gather_Op&)>> { public: static const std::string Type; diff --git a/include/aidge/operator/GenericOperator.hpp b/include/aidge/operator/GenericOperator.hpp index 41516a39723249b5b5c715a66ce3398dff8e65b1..106168c54b63836caae2c9080bd038655d94e4c7 100644 --- a/include/aidge/operator/GenericOperator.hpp +++ b/include/aidge/operator/GenericOperator.hpp @@ -26,7 +26,7 @@ namespace Aidge { class GenericOperator_Op : public OperatorTensor, - public Registrable<GenericOperator_Op, std::string, std::unique_ptr<OperatorImpl>(std::shared_ptr<GenericOperator_Op>)> { + public Registrable<GenericOperator_Op, std::string, std::function<std::unique_ptr<OperatorImpl>(std::shared_ptr<GenericOperator_Op>)>> { private: using ComputeDimsFunc = std::function<std::vector<std::vector<size_t>>(const std::vector<std::vector<size_t>>&)>; diff --git a/include/aidge/operator/GlobalAveragePooling.hpp b/include/aidge/operator/GlobalAveragePooling.hpp index 734e12344fed4cd25dd41e91dc8cfb18fea4fd45..4c139e63d6deadfdfb7e82cfb029407fd9715799 100644 --- a/include/aidge/operator/GlobalAveragePooling.hpp +++ b/include/aidge/operator/GlobalAveragePooling.hpp @@ -32,8 +32,8 @@ namespace Aidge { class GlobalAveragePooling_Op : public OperatorTensor, public Registrable<GlobalAveragePooling_Op, std::string, - std::shared_ptr<OperatorImpl>( - const GlobalAveragePooling_Op &)> { + std::function<std::shared_ptr<OperatorImpl>( + const GlobalAveragePooling_Op &)>> { public: static const std::string Type; diff --git a/include/aidge/operator/GridSample.hpp b/include/aidge/operator/GridSample.hpp index af44a5df5de6908d58951b93921d49ec8e7df708..b5c99f02710085592dce9ab576b3f665c45db442 100644 --- a/include/aidge/operator/GridSample.hpp +++ b/include/aidge/operator/GridSample.hpp @@ -29,7 +29,7 @@ enum class GridSampleAttr { Mode, PaddingMode, AlignCorners }; template <DimIdx_t DIM> class GridSample_Op : public OperatorTensor, - public Registrable<GridSample_Op<DIM>, std::string, std::shared_ptr<OperatorImpl>(const GridSample_Op<DIM>&)> { + public Registrable<GridSample_Op<DIM>, std::string, std::function<std::shared_ptr<OperatorImpl>(const GridSample_Op<DIM>&)>> { public: static const std::string Type; diff --git a/include/aidge/operator/Identity.hpp b/include/aidge/operator/Identity.hpp index 622d6290af55ef5a717c6f5763ade5a2750fb9f0..69ab82963eee75c54b00b711d65b90f6da0519db 100644 --- a/include/aidge/operator/Identity.hpp +++ b/include/aidge/operator/Identity.hpp @@ -35,7 +35,7 @@ namespace Aidge { * */ class Identity_Op : public OperatorTensor, - public Registrable<Identity_Op, std::string, std::unique_ptr<OperatorImpl>(const Identity_Op&)> { + public Registrable<Identity_Op, std::string, std::function<std::unique_ptr<OperatorImpl>(const Identity_Op&)>> { public: static const std::string Type; diff --git a/include/aidge/operator/LeakyReLU.hpp b/include/aidge/operator/LeakyReLU.hpp index 30d171eab3ee54864aae48f445e4d0f04792dd31..a6188221deb8912f51daf17ee0e041afef311015 100644 --- a/include/aidge/operator/LeakyReLU.hpp +++ b/include/aidge/operator/LeakyReLU.hpp @@ -29,7 +29,7 @@ enum class LeakyReLUAttr { }; class LeakyReLU_Op : public OperatorTensor, - public Registrable<LeakyReLU_Op, std::string, std::shared_ptr<OperatorImpl>(const LeakyReLU_Op&)> { + public Registrable<LeakyReLU_Op, std::string, std::function<std::shared_ptr<OperatorImpl>(const LeakyReLU_Op&)>> { public: static const std::string Type; diff --git a/include/aidge/operator/Ln.hpp b/include/aidge/operator/Ln.hpp index c6a9ec4c8d59800cdbcc3f0229acdbbb436cd732..e606f670aa18484584f0b9442ee569fab3386cb9 100755 --- a/include/aidge/operator/Ln.hpp +++ b/include/aidge/operator/Ln.hpp @@ -26,7 +26,7 @@ namespace Aidge { class Ln_Op : public OperatorTensor, - public Registrable<Ln_Op, std::string, std::unique_ptr<OperatorImpl>(const Ln_Op&)> { + public Registrable<Ln_Op, std::string, std::function<std::unique_ptr<OperatorImpl>(const Ln_Op&)>> { public: static const std::string Type; diff --git a/include/aidge/operator/MatMul.hpp b/include/aidge/operator/MatMul.hpp index f81fb7bd0a3156fcffccc10fe3d460273f353252..25a60a429baadcbc2c85af4915cef694ed6adc41 100644 --- a/include/aidge/operator/MatMul.hpp +++ b/include/aidge/operator/MatMul.hpp @@ -26,7 +26,7 @@ namespace Aidge { class MatMul_Op : public OperatorTensor, public Registrable<MatMul_Op, std::string, - std::shared_ptr<OperatorImpl>(const MatMul_Op &)> { + std::function<std::shared_ptr<OperatorImpl>(const MatMul_Op &)>> { public: static const std::string Type; diff --git a/include/aidge/operator/MaxPooling.hpp b/include/aidge/operator/MaxPooling.hpp index 3b7473a6a17e8ebf490941068c8245d5847e0299..ff0208aa9818cb4f01fae41486c40a2395396d60 100644 --- a/include/aidge/operator/MaxPooling.hpp +++ b/include/aidge/operator/MaxPooling.hpp @@ -33,7 +33,7 @@ enum class MaxPoolingAttr { StrideDims, KernelDims, CeilMode }; template <DimIdx_t DIM> class MaxPooling_Op : public OperatorTensor, - public Registrable<MaxPooling_Op<DIM>, std::string, std::shared_ptr<OperatorImpl>(const MaxPooling_Op<DIM> &)> { + public Registrable<MaxPooling_Op<DIM>, std::string, std::function<std::shared_ptr<OperatorImpl>(const MaxPooling_Op<DIM> &)>> { public: static const std::string Type; diff --git a/include/aidge/operator/Memorize.hpp b/include/aidge/operator/Memorize.hpp index a1d90f06f098eb7fa2fc199b595991702daf488a..8adac69f88ea4ed5e7d3b7549f7a41446db47ca6 100644 --- a/include/aidge/operator/Memorize.hpp +++ b/include/aidge/operator/Memorize.hpp @@ -37,7 +37,7 @@ public: enum class MemorizeAttr { ScheduleStep, ForwardStep, EndStep }; class Memorize_Op : public OperatorTensor, - public Registrable<Memorize_Op, std::string, std::unique_ptr<OperatorImpl>(const Memorize_Op&)> { + public Registrable<Memorize_Op, std::string, std::function<std::unique_ptr<OperatorImpl>(const Memorize_Op&)>> { public: static const std::string Type; diff --git a/include/aidge/operator/MetaOperator.hpp b/include/aidge/operator/MetaOperator.hpp index 69f2120d90beb727bd661628c362410066ae3cff..dc9f0e8ad4380cfbebc502fcad736a82f793091d 100644 --- a/include/aidge/operator/MetaOperator.hpp +++ b/include/aidge/operator/MetaOperator.hpp @@ -27,7 +27,7 @@ namespace Aidge { class MetaOperator_Op : public OperatorTensor, - public Registrable<MetaOperator_Op, std::array<std::string, 2>, std::unique_ptr<OperatorImpl>(const MetaOperator_Op &)> { + public Registrable<MetaOperator_Op, std::array<std::string, 2>, std::function<std::unique_ptr<OperatorImpl>(const MetaOperator_Op &)>> { public: // outputs shared with micro-graph output Tensors // Micro-graph handling: diff --git a/include/aidge/operator/Move.hpp b/include/aidge/operator/Move.hpp index 9908911419d8ce027cdb18c4abf45a5c71be67b1..2aed78f99a41303551dd69ae5605fbb735435760 100644 --- a/include/aidge/operator/Move.hpp +++ b/include/aidge/operator/Move.hpp @@ -31,7 +31,7 @@ public: }; class Move_Op : public OperatorTensor, - public Registrable<Move_Op, std::tuple<std::string, std::string>, std::unique_ptr<OperatorImpl>(const Move_Op&)> { + public Registrable<Move_Op, std::tuple<std::string, std::string>, std::function<std::unique_ptr<OperatorImpl>(const Move_Op&)>> { public: static const std::string Type; diff --git a/include/aidge/operator/Mul.hpp b/include/aidge/operator/Mul.hpp index 35a4b7e061bba76f1e63343e9230eddddfde11ac..519d4e1f9f5203212e761e4a4513472634813e9c 100644 --- a/include/aidge/operator/Mul.hpp +++ b/include/aidge/operator/Mul.hpp @@ -28,7 +28,7 @@ namespace Aidge { * @brief Tensor element-wise multiplication. */ class Mul_Op : public OperatorTensor, - public Registrable<Mul_Op, std::string, std::shared_ptr<OperatorImpl>(const Mul_Op&)> { + public Registrable<Mul_Op, std::string, std::function<std::shared_ptr<OperatorImpl>(const Mul_Op&)>> { public: static const std::string Type; diff --git a/include/aidge/operator/Pad.hpp b/include/aidge/operator/Pad.hpp index bdb5330a6fd02693f4d75ccba06ce613d9a0dff1..d47549151be82a8b6e042b86cc2a44a912a194f2 100644 --- a/include/aidge/operator/Pad.hpp +++ b/include/aidge/operator/Pad.hpp @@ -29,7 +29,7 @@ enum class PadBorderType { Constant, Edge, Reflect, Wrap }; template <DimIdx_t DIM> class Pad_Op : public OperatorTensor, - public Registrable<Pad_Op<DIM>, std::string, std::shared_ptr<OperatorImpl>(const Pad_Op<DIM> &)> { + public Registrable<Pad_Op<DIM>, std::string, std::function<std::shared_ptr<OperatorImpl>(const Pad_Op<DIM> &)>> { public: static const std::string Type; diff --git a/include/aidge/operator/Pow.hpp b/include/aidge/operator/Pow.hpp index eaf4297fd8b3751463a20ae219af5c25ecd789ae..d38cb1a33e1ac4fd0a81f31c32e6537da4e66622 100644 --- a/include/aidge/operator/Pow.hpp +++ b/include/aidge/operator/Pow.hpp @@ -25,7 +25,7 @@ namespace Aidge { class Pow_Op : public OperatorTensor, - public Registrable<Pow_Op, std::string, std::shared_ptr<OperatorImpl>(const Pow_Op&)> { + public Registrable<Pow_Op, std::string, std::function<std::shared_ptr<OperatorImpl>(const Pow_Op&)>> { public: static const std::string Type; diff --git a/include/aidge/operator/Producer.hpp b/include/aidge/operator/Producer.hpp index 257a6965be4c08735f23ae575ffe104bb706593a..2b3d7684c5352536f2379a4fae044055dd83492c 100644 --- a/include/aidge/operator/Producer.hpp +++ b/include/aidge/operator/Producer.hpp @@ -30,8 +30,8 @@ enum class ProdAttr { Constant }; class Producer_Op : public OperatorTensor, - public Registrable<Producer_Op, std::string, std::shared_ptr<OperatorImpl>( - const Producer_Op &)> { + public Registrable<Producer_Op, std::string, std::function<std::shared_ptr<OperatorImpl>( + const Producer_Op &)>> { public: static const std::string Type; diff --git a/include/aidge/operator/ReLU.hpp b/include/aidge/operator/ReLU.hpp index cc714c4619a0f8eee7af03993700fed7489a6c0e..350f30bc70eccd0bba2bb61b5f01266fa194b177 100644 --- a/include/aidge/operator/ReLU.hpp +++ b/include/aidge/operator/ReLU.hpp @@ -26,7 +26,7 @@ namespace Aidge { class ReLU_Op : public OperatorTensor, - public Registrable<ReLU_Op, std::string, std::shared_ptr<OperatorImpl>(const ReLU_Op&)> { + public Registrable<ReLU_Op, std::string, std::function<std::shared_ptr<OperatorImpl>(const ReLU_Op&)>> { public: static const std::string Type; diff --git a/include/aidge/operator/ReduceMean.hpp b/include/aidge/operator/ReduceMean.hpp index 07beb0a39a88254f0aecdda35cd63f5d338af532..ec7a0d4cdd035cfe334f1b918ec77f2625b91c19 100644 --- a/include/aidge/operator/ReduceMean.hpp +++ b/include/aidge/operator/ReduceMean.hpp @@ -29,7 +29,7 @@ namespace Aidge { enum class ReduceMeanAttr { Axes, KeepDims }; class ReduceMean_Op : public OperatorTensor, - public Registrable<ReduceMean_Op, std::string, std::shared_ptr<OperatorImpl>(const ReduceMean_Op &)> { + public Registrable<ReduceMean_Op, std::string, std::function<std::shared_ptr<OperatorImpl>(const ReduceMean_Op &)>> { public: static const std::string Type; diff --git a/include/aidge/operator/Reshape.hpp b/include/aidge/operator/Reshape.hpp index 5bd9b3e8d56c106803bf65dc7bf595da85558a1a..16d14a19c5d1cdc7c13a9c2e33445466c5d1a398 100644 --- a/include/aidge/operator/Reshape.hpp +++ b/include/aidge/operator/Reshape.hpp @@ -32,7 +32,7 @@ public: enum class ReshapeAttr { Shape, AllowZero }; class Reshape_Op : public OperatorTensor, - public Registrable<Reshape_Op, std::string, std::shared_ptr<OperatorImpl>(const Reshape_Op&)> { + public Registrable<Reshape_Op, std::string, std::function<std::shared_ptr<OperatorImpl>(const Reshape_Op&)>> { public: static const std::string Type; diff --git a/include/aidge/operator/Resize.hpp b/include/aidge/operator/Resize.hpp index 622a1ff1b191aad9f3f8045380be522d32cf2845..e3551d72d6e1d39a5117e59ba8eaf9da44c8df38 100644 --- a/include/aidge/operator/Resize.hpp +++ b/include/aidge/operator/Resize.hpp @@ -25,7 +25,7 @@ namespace Aidge { class Resize_Op : public OperatorTensor, - public Registrable<Resize_Op, std::string, std::shared_ptr<OperatorImpl>(const Resize_Op&)>{ + public Registrable<Resize_Op, std::string, std::function<std::shared_ptr<OperatorImpl>(const Resize_Op&)>>{ public: static const std::string Type; diff --git a/include/aidge/operator/Scaling.hpp b/include/aidge/operator/Scaling.hpp index 311dc0202d866253bb98285e77e6d6ea8b345e0f..15393755f6e2f86909152924f1381bad6cd9a2d5 100644 --- a/include/aidge/operator/Scaling.hpp +++ b/include/aidge/operator/Scaling.hpp @@ -30,7 +30,7 @@ enum class ScalingAttr { class Scaling_Op : public OperatorTensor, - public Registrable<Scaling_Op, std::string, std::shared_ptr<OperatorImpl>(const Scaling_Op&)> { + public Registrable<Scaling_Op, std::string, std::function<std::shared_ptr<OperatorImpl>(const Scaling_Op&)>> { public: static const std::string Type; diff --git a/include/aidge/operator/Shape.hpp b/include/aidge/operator/Shape.hpp index d76a9fd069ebbda81e446e6f3486ff0ff66755bb..ebe345d1597b7c6d3a71d2273e8c88a6c6d77f26 100644 --- a/include/aidge/operator/Shape.hpp +++ b/include/aidge/operator/Shape.hpp @@ -36,7 +36,7 @@ enum class ShapeAttr { Start, End }; class Shape_Op : public OperatorTensor, public Registrable<Shape_Op, std::string, - std::shared_ptr<OperatorImpl>(const Shape_Op&)> { + std::function<std::shared_ptr<OperatorImpl>(const Shape_Op&)>> { public: static const std::string Type; diff --git a/include/aidge/operator/ShiftGELU.hpp b/include/aidge/operator/ShiftGELU.hpp index 4d3000750c2224aaea278beca4c8124e0845042e..d157a92028a93ab895b05498658432b38ce03fd9 100644 --- a/include/aidge/operator/ShiftGELU.hpp +++ b/include/aidge/operator/ShiftGELU.hpp @@ -28,7 +28,7 @@ namespace Aidge { class ShiftGELU_Op : public OperatorTensor, - public Registrable<ShiftGELU_Op, std::string, std::shared_ptr<OperatorImpl>(const ShiftGELU_Op&)> { + public Registrable<ShiftGELU_Op, std::string, std::function<std::shared_ptr<OperatorImpl>(const ShiftGELU_Op&)>> { public: static const std::string Type; diff --git a/include/aidge/operator/ShiftMax.hpp b/include/aidge/operator/ShiftMax.hpp index d75e6559f5f4df9a1010d65ba97529e6165ae42f..c37948625a401d0466449d21dbcdcf76d0a41bb9 100644 --- a/include/aidge/operator/ShiftMax.hpp +++ b/include/aidge/operator/ShiftMax.hpp @@ -28,7 +28,7 @@ namespace Aidge { class ShiftMax_Op : public OperatorTensor, - public Registrable<ShiftMax_Op, std::string, std::shared_ptr<OperatorImpl>(const ShiftMax_Op&)> { + public Registrable<ShiftMax_Op, std::string, std::function<std::shared_ptr<OperatorImpl>(const ShiftMax_Op&)>> { public: static const std::string Type; diff --git a/include/aidge/operator/Sigmoid.hpp b/include/aidge/operator/Sigmoid.hpp index b3204240cd130251fe8abe7d50bdad9b92b7558c..a18fc6df03c7fc9d40957ebe2d02aa938d6131af 100644 --- a/include/aidge/operator/Sigmoid.hpp +++ b/include/aidge/operator/Sigmoid.hpp @@ -26,7 +26,7 @@ namespace Aidge { class Sigmoid_Op : public OperatorTensor, - public Registrable<Sigmoid_Op, std::string, std::unique_ptr<OperatorImpl>(const Sigmoid_Op&)> { + public Registrable<Sigmoid_Op, std::string, std::function<std::unique_ptr<OperatorImpl>(const Sigmoid_Op&)>> { public: static const std::string Type; diff --git a/include/aidge/operator/Slice.hpp b/include/aidge/operator/Slice.hpp index 241e165a0e441ccb856431225ce1d6fd170a25f8..5eba32c1d5786df5293e5cb634f37d7b1477c947 100644 --- a/include/aidge/operator/Slice.hpp +++ b/include/aidge/operator/Slice.hpp @@ -29,7 +29,7 @@ enum class SliceAttr { Starts, Ends, Axes, Steps }; class Slice_Op : public OperatorTensor, - public Registrable<Slice_Op, std::string, std::shared_ptr<OperatorImpl>(const Slice_Op &)> { + public Registrable<Slice_Op, std::string, std::function<std::shared_ptr<OperatorImpl>(const Slice_Op &)>> { public: static const std::string Type; diff --git a/include/aidge/operator/Softmax.hpp b/include/aidge/operator/Softmax.hpp index c221a67e31fc6de1bcb2c727854c8ebee2986ee4..eb21cac38397512636edad980b002aeb99602647 100644 --- a/include/aidge/operator/Softmax.hpp +++ b/include/aidge/operator/Softmax.hpp @@ -29,7 +29,7 @@ enum class SoftmaxAttr { Axis }; class Softmax_Op : public OperatorTensor, public Registrable<Softmax_Op, std::string, - std::shared_ptr<OperatorImpl>(const Softmax_Op&)> { + std::function<std::shared_ptr<OperatorImpl>(const Softmax_Op&)>> { public: static const std::string Type; diff --git a/include/aidge/operator/Split.hpp b/include/aidge/operator/Split.hpp index 661f9e32d47c7fb7e0c111805a50c6fcc131cffe..66d23547d7d4b748bf6bda2c4b18f9caa11ff694 100644 --- a/include/aidge/operator/Split.hpp +++ b/include/aidge/operator/Split.hpp @@ -34,7 +34,7 @@ enum class SplitAttr { Axis, Split }; class Split_Op : public OperatorTensor, - public Registrable<Split_Op, std::string, std::shared_ptr<OperatorImpl>(const Split_Op &)> { + public Registrable<Split_Op, std::string, std::function<std::shared_ptr<OperatorImpl>(const Split_Op &)>> { public: static const std::string Type; diff --git a/include/aidge/operator/Sqrt.hpp b/include/aidge/operator/Sqrt.hpp index ce4aaafc92d1f7d601946c02d4eb025eb735a3f9..e3c7ba28c1d0be3cdbc1a09ccc7b0cdfe280d363 100644 --- a/include/aidge/operator/Sqrt.hpp +++ b/include/aidge/operator/Sqrt.hpp @@ -26,7 +26,7 @@ namespace Aidge { class Sqrt_Op : public OperatorTensor, public Registrable<Sqrt_Op, std::string, - std::shared_ptr<OperatorImpl>(const Sqrt_Op&)> { + std::function<std::shared_ptr<OperatorImpl>(const Sqrt_Op&)>> { public: static const std::string Type; diff --git a/include/aidge/operator/Sub.hpp b/include/aidge/operator/Sub.hpp index bb29ba67851bce8eed46ab1d4df3cf7a8ce91a1a..a7c3fd16f4252c85696e4b1a1df2f154f5a2c50a 100644 --- a/include/aidge/operator/Sub.hpp +++ b/include/aidge/operator/Sub.hpp @@ -25,7 +25,7 @@ namespace Aidge { class Sub_Op : public OperatorTensor, - public Registrable<Sub_Op, std::string, std::shared_ptr<OperatorImpl>(const Sub_Op&)> { + public Registrable<Sub_Op, std::string, std::function<std::shared_ptr<OperatorImpl>(const Sub_Op&)>> { public: static const std::string Type; diff --git a/include/aidge/operator/Tanh.hpp b/include/aidge/operator/Tanh.hpp index fd05bf7c434ec2547995800f47380c53585ca6d7..9731fc9c12a8863622ba81d5560df2baabe78f56 100644 --- a/include/aidge/operator/Tanh.hpp +++ b/include/aidge/operator/Tanh.hpp @@ -24,7 +24,7 @@ namespace Aidge { class Tanh_Op : public OperatorTensor, - public Registrable<Tanh_Op, std::string, std::unique_ptr<OperatorImpl>(const Tanh_Op&)> { + public Registrable<Tanh_Op, std::string, std::function<std::unique_ptr<OperatorImpl>(const Tanh_Op&)>> { public: static const std::string Type; diff --git a/include/aidge/operator/Transpose.hpp b/include/aidge/operator/Transpose.hpp index 375d6e098324516b750f8054f9214390373737e2..ba96a6c69f39f2fade1c44165fc99c3f80497736 100644 --- a/include/aidge/operator/Transpose.hpp +++ b/include/aidge/operator/Transpose.hpp @@ -36,7 +36,7 @@ public: enum class TransposeAttr { OutputDimsOrder }; class Transpose_Op : public OperatorTensor, - public Registrable<Transpose_Op, std::string, std::shared_ptr<OperatorImpl>(const Transpose_Op&)> { + public Registrable<Transpose_Op, std::string, std::function<std::shared_ptr<OperatorImpl>(const Transpose_Op&)>> { public: static const std::string Type; diff --git a/include/aidge/operator/Unfold.hpp b/include/aidge/operator/Unfold.hpp index 3fda7c21405ef023f4324089e60be0330b5f34b6..63b802595afb7ae624c4f17749a54683c9975b1a 100644 --- a/include/aidge/operator/Unfold.hpp +++ b/include/aidge/operator/Unfold.hpp @@ -41,7 +41,7 @@ enum class UnfoldAttr { StrideDims, DilationDims, KernelDims }; template <DimIdx_t DIM> class Unfold_Op : public OperatorTensor, - public Registrable<Unfold_Op<DIM>, std::string, std::shared_ptr<OperatorImpl>(const Unfold_Op<DIM> &)> { + public Registrable<Unfold_Op<DIM>, std::string, std::function<std::shared_ptr<OperatorImpl>(const Unfold_Op<DIM> &)>> { public: static const std::string Type; diff --git a/include/aidge/stimuli/Stimulus.hpp b/include/aidge/stimuli/Stimulus.hpp index 80e7c76d4857f577f30b90588f4c3998be80bdb8..3def790b65f441c567e5d43150f465233cb64557 100644 --- a/include/aidge/stimuli/Stimulus.hpp +++ b/include/aidge/stimuli/Stimulus.hpp @@ -26,7 +26,7 @@ namespace Aidge { * @brief Stimulus. A class wrapping a data sample. Stimulus has two functioning modes. The first mode enables to load data samples from a dataPath and optionnaly store the data in-memory. The second mode enables to store a data sample that was already loaded in memory. * @details When Stimulus is used in the first mode, the loading function is determined automaticaly based on the backend and the file extension. */ -class Stimulus : public Registrable<Stimulus, std::tuple<std::string, std::string>, std::unique_ptr<StimulusImpl>(const std::string&)> { +class Stimulus : public Registrable<Stimulus, std::tuple<std::string, std::string>, std::function<std::unique_ptr<StimulusImpl>(const std::string&)>> { private: /// Stimulus data path const std::string mDataPath; diff --git a/include/aidge/utils/Registrar.hpp b/include/aidge/utils/Registrar.hpp index 872c3f6b5a258292c41428852580210ab32decbf..1d76d859e32729b2bd0e5929b9511a8718245fbb 100644 --- a/include/aidge/utils/Registrar.hpp +++ b/include/aidge/utils/Registrar.hpp @@ -37,21 +37,21 @@ template <class DerivedClass, class Key, class Func> // curiously rucurring temp class Registrable { public: typedef Key registrar_key; - typedef std::function<Func> registrar_type; + typedef Func registrar_type; - static std::map<Key, std::function<Func>>& registry() + static std::map<Key, Func>& registry() { #ifdef PYBIND #define _CRT_SECURE_NO_WARNINGS if (Py_IsInitialized()){ std::string name = std::string("registrar_")+typeid(Registrable<DerivedClass, Key, Func>).name(); - static auto shared_data = reinterpret_cast<std::map<Key, std::function<Func>> *>(py::get_shared_data(name)); + static auto shared_data = reinterpret_cast<std::map<Key, Func> *>(py::get_shared_data(name)); if (!shared_data) - shared_data = static_cast<std::map<Key, std::function<Func>> *>(py::set_shared_data(name, new std::map<Key, std::function<Func>>())); + shared_data = static_cast<std::map<Key, Func> *>(py::set_shared_data(name, new std::map<Key, Func>())); return *shared_data; } #endif // PYBIND - static std::map<Key, std::function<Func>> rMap; + static std::map<Key, Func> rMap; return rMap; } @@ -77,7 +77,7 @@ struct Registrar { static auto create(const registrar_key& key) { AIDGE_ASSERT(exists(key), "missing or invalid registrar key: {} for registrable object {}\nDid you include/import the corresponding module?\nIf so, it is possible that the object is not yet supported.", key, typeid(C).name()); - return C::registry()[key]; + return C::registry().at(key); } static std::vector<registrar_key> getKeys(){ std::vector<registrar_key> keys; diff --git a/python_binding/data/pybind_Tensor.cpp b/python_binding/data/pybind_Tensor.cpp index d4d6edc9ca4d51eabe0665352997f5d5469bff74..8f96c28d4108ea39b6a62e405139fd969d603838 100644 --- a/python_binding/data/pybind_Tensor.cpp +++ b/python_binding/data/pybind_Tensor.cpp @@ -25,7 +25,7 @@ namespace Aidge { using registrableTensor = Registrable<Tensor, std::tuple<std::string, DataType>, - std::shared_ptr<TensorImpl>(DeviceIdx_t device, std::vector<DimSize_t> dims)>; + std::function<std::shared_ptr<TensorImpl>(DeviceIdx_t device, std::vector<DimSize_t> dims)>>; using pyTensorClass = py::class_<Tensor, std::shared_ptr<Tensor>,