diff --git a/src/framework/operator.h b/src/framework/operator.h index 6a89884e9beb23878b422f77a5ed2851da6950e6..c85a38d73c620ae4b08387b548bd2f4f8ca71711 100644 --- a/src/framework/operator.h +++ b/src/framework/operator.h @@ -63,6 +63,7 @@ class OperatorBase { std::vector GetOutKeys() const; virtual void RunImpl() const = 0; + virtual void Init() const = 0; /* * @b op 运算所需的输入, 如上一层的输出结果、卷积核 * */ @@ -110,15 +111,17 @@ class OperatorWithKernel : public OperatorBase { const VariableNameMap &outputs, const AttributeMap &attrs, std::shared_ptr scope) : OperatorBase(type, inputs, outputs, attrs, scope), - param_(inputs, outputs, attrs, *scope) { - PADDLE_MOBILE_ENFORCE(kernel_.Init(param_), " %s kernel init failed", - this->type_.c_str()); - } + param_(inputs, outputs, attrs, *scope) {} virtual void RunImpl() const { this->kernel_.Compute(this->param_); } virtual void InferShape() const = 0; + void Init() const { + PADDLE_MOBILE_ENFORCE(kernel_.Init(param_), " %s kernel init failed", + this->type_.c_str()); + } + protected: KernelType kernel_; ParamType param_; diff --git a/src/io/io.cpp b/src/io/io.cpp index 7931432bd1d4528ab9b0cda7ab05ab13c14dfcfe..c7f8f174ac825463f66fd50b72e0c58d50bd537e 100644 --- a/src/io/io.cpp +++ b/src/io/io.cpp @@ -198,6 +198,13 @@ Executor::Executor(const framework::Program p, int batch_size, } else { InitMemory(); } + + std::shared_ptr to_predict_block = + to_predict_program_->Block(0); + auto &ops = ops_of_block_[*to_predict_block.get()]; + for (const auto &op : ops) { + op->Init(); + } } template @@ -416,6 +423,8 @@ std::shared_ptr Executor::Predict( clock_gettime(CLOCK_MONOTONIC, &ts); profile[i].runBegin = (uint64_t)ts.tv_sec * 1e9 + ts.tv_nsec; #endif + + // to Run ops[i]->Run(); #ifdef PADDLE_MOBILE_PROFILE clock_gettime(CLOCK_MONOTONIC, &ts); diff --git a/src/operators/feed_op.h b/src/operators/feed_op.h index 9079dbb0b3d83b2b28a046ae3d78025a24fc4958..034cf947871a962b786b66e3752d86f5a327f342 100644 --- a/src/operators/feed_op.h +++ b/src/operators/feed_op.h @@ -32,6 +32,8 @@ class FeedOp : public framework::OperatorBase { param_(inputs, outputs, attrs, *scope) {} void RunImpl() const { param_.Out()->ShareDataWith(*param_.InputX()); } + void Init() const {} + void InferShape() const { auto out_dims = param_.Out()->dims(); out_dims[0] = param_.BatchSize(); diff --git a/src/operators/fetch_op.h b/src/operators/fetch_op.h index a65338f7f4262de1b74d7a18525f6c3b9551243a..c28424f0d1880c9f7f44c6644a163215d639f7a3 100644 --- a/src/operators/fetch_op.h +++ b/src/operators/fetch_op.h @@ -33,6 +33,8 @@ class FetchOp : public framework::OperatorBase { param_(inputs, outputs, attrs, *scope) {} void RunImpl() const { param_.Out()->ShareDataWith(*param_.InputX()); } + void Init() const {} + void InferShape() const { auto x_dims = param_.InputX()->dims(); param_.Out()->Resize(x_dims); diff --git a/src/operators/kernel/arm/batchnorm_kernel.cpp b/src/operators/kernel/arm/batchnorm_kernel.cpp index cb30fb41e936543737cd48717920c6a62fb19033..af4639c4e7c13d486ad78f4877db19c6d3e15a31 100644 --- a/src/operators/kernel/arm/batchnorm_kernel.cpp +++ b/src/operators/kernel/arm/batchnorm_kernel.cpp @@ -21,6 +21,11 @@ limitations under the License. */ namespace paddle_mobile { namespace operators { +template <> +bool BatchNormKernel::Init(const BatchNormParam ¶) const { + return true; +} + template <> void BatchNormKernel::Compute(const BatchNormParam ¶m) const { const Tensor *input_x = param.InputX(); diff --git a/src/operators/kernel/arm/box_coder_kernel.cpp b/src/operators/kernel/arm/box_coder_kernel.cpp index 9654228911af77e751e4ef9d1b92fb92ae30591d..02ec85a444c380ba76d64b0d15d35ce27b9eaf44 100644 --- a/src/operators/kernel/arm/box_coder_kernel.cpp +++ b/src/operators/kernel/arm/box_coder_kernel.cpp @@ -109,6 +109,11 @@ void DecodeCenterSize(const framework::Tensor& target_box, } } +template <> +bool BoxCoderKernel::Init(const BoxCoderParam& para) const { + return true; +} + template <> void BoxCoderKernel::Compute(const BoxCoderParam& param) const { const auto* input_priorbox = param.InputPriorBox(); diff --git a/src/operators/kernel/arm/concat_kernel.cpp b/src/operators/kernel/arm/concat_kernel.cpp index 329677fb11e6ee2db74b5191586ac6157ede9697..0312047b8e8af1eb9dad57c751e392e8a5054878 100644 --- a/src/operators/kernel/arm/concat_kernel.cpp +++ b/src/operators/kernel/arm/concat_kernel.cpp @@ -52,6 +52,11 @@ class ConcatFunctor { } }; +template <> +bool ConcatKernel::Init(const ConcatParam ¶) const { + return true; +} + template <> void ConcatKernel::Compute(const ConcatParam ¶m) const { auto inputs = param.Inputs(); diff --git a/src/operators/kernel/arm/conv_add_kernel.cpp b/src/operators/kernel/arm/conv_add_kernel.cpp index 1cb61b03dc1d011f45a802eb002824d4bb9f5352..4bde8289007415dccbc7a630c7646ac718087c55 100644 --- a/src/operators/kernel/arm/conv_add_kernel.cpp +++ b/src/operators/kernel/arm/conv_add_kernel.cpp @@ -18,6 +18,11 @@ limitations under the License. */ namespace paddle_mobile { namespace operators { +template <> +bool ConvAddKernel::Init(const FusionConvAddParam ¶) const { + return true; +} + template <> void ConvAddKernel::Compute(const FusionConvAddParam ¶m) const { const Tensor *input = param.Input(); diff --git a/src/operators/kernel/arm/conv_add_relu_kernel.cpp b/src/operators/kernel/arm/conv_add_relu_kernel.cpp index 2be08d5379b7e5202f79d2829ba79cbee1b0a2c9..2df48222e0923e403f2ad44b3d5c4a89aceb4cc4 100644 --- a/src/operators/kernel/arm/conv_add_relu_kernel.cpp +++ b/src/operators/kernel/arm/conv_add_relu_kernel.cpp @@ -19,6 +19,12 @@ limitations under the License. */ namespace paddle_mobile { namespace operators { +template <> +bool ConvAddReluKernel::Init( + const FusionConvAddReluParam ¶) const { + return true; +} + template <> void ConvAddReluKernel::Compute( const FusionConvAddReluParam ¶m) const { diff --git a/src/operators/kernel/arm/conv_kernel.cpp b/src/operators/kernel/arm/conv_kernel.cpp index 1ec022ffab41fc41084220651d286b20ea43d7bb..ce7c8b2bb3d596bc365eecd31ae4181f37be5e38 100644 --- a/src/operators/kernel/arm/conv_kernel.cpp +++ b/src/operators/kernel/arm/conv_kernel.cpp @@ -19,6 +19,11 @@ limitations under the License. */ namespace paddle_mobile { namespace operators { +template <> +bool ConvKernel::Init(const ConvParam ¶) const { + return true; +} + template <> void ConvKernel::Compute(const ConvParam ¶m) const { const Tensor *input = param.Input(); diff --git a/src/operators/kernel/arm/depthwise_conv_kernel.cpp b/src/operators/kernel/arm/depthwise_conv_kernel.cpp index e6f27b772562789e07807b2b56c1f9d73bf373a9..6cd16fda0dc6ea9928ab9fcfac5cd8b3c31a15a2 100644 --- a/src/operators/kernel/arm/depthwise_conv_kernel.cpp +++ b/src/operators/kernel/arm/depthwise_conv_kernel.cpp @@ -20,6 +20,11 @@ limitations under the License. */ namespace paddle_mobile { namespace operators { +template <> +bool DepthwiseConvKernel::Init(const ConvParam ¶) const { + return true; +} + template <> void DepthwiseConvKernel::Compute(const ConvParam ¶m) const { LOG(kLOG_DEBUG) << param; diff --git a/src/operators/kernel/arm/elementwise_add_kernel.cpp b/src/operators/kernel/arm/elementwise_add_kernel.cpp index 02aabfe3ce0622df80c86906f45ab5cc688c7b12..2f5e26a37e4f2c1d370805ee7b565a60f4748b0a 100644 --- a/src/operators/kernel/arm/elementwise_add_kernel.cpp +++ b/src/operators/kernel/arm/elementwise_add_kernel.cpp @@ -26,6 +26,12 @@ struct AddFunctor { inline T operator()(T a, T b) const { return a + b; } }; +template <> +bool ElementwiseAddKernel::Init( + const ElementwiseAddParam ¶) const { + return true; +} + template <> void ElementwiseAddKernel::Compute( const ElementwiseAddParam ¶m) const { diff --git a/src/operators/kernel/arm/fusion_fc_kernel.cpp b/src/operators/kernel/arm/fusion_fc_kernel.cpp index 3cf6458fc7a476eda8566c97a62971f1a72da496..5fac70e40781593669abd15b8f28ff6272f7133c 100644 --- a/src/operators/kernel/arm/fusion_fc_kernel.cpp +++ b/src/operators/kernel/arm/fusion_fc_kernel.cpp @@ -21,6 +21,11 @@ limitations under the License. */ namespace paddle_mobile { namespace operators { +template <> +bool FusionFcKernel::Init(const FusionFcParam ¶) const { + return true; +} + template <> void FusionFcKernel::Compute(const FusionFcParam ¶m) const { const Tensor *input_x = param.InputX(); diff --git a/src/operators/kernel/arm/lrn_kernel.cpp b/src/operators/kernel/arm/lrn_kernel.cpp index 5ac4c67559ebe1603230e0d50895d0702c38cb77..839c5ee95bd4d1e9d3fd80af3df0f8a45797434e 100644 --- a/src/operators/kernel/arm/lrn_kernel.cpp +++ b/src/operators/kernel/arm/lrn_kernel.cpp @@ -21,6 +21,11 @@ limitations under the License. */ namespace paddle_mobile { namespace operators { +template <> +bool LrnKernel::Init(const LrnParam ¶) const { + return true; +} + template <> void LrnKernel::Compute(const LrnParam ¶m) const { const Tensor *input_x = param.InputX(); diff --git a/src/operators/kernel/arm/mul_kernel.cpp b/src/operators/kernel/arm/mul_kernel.cpp index 70bcac2461cdef535de8c9759ec10113e45b7ae2..b3bb2b8075fdf306d47640c2bee3f2fc00ef0bc0 100644 --- a/src/operators/kernel/arm/mul_kernel.cpp +++ b/src/operators/kernel/arm/mul_kernel.cpp @@ -21,6 +21,11 @@ limitations under the License. */ namespace paddle_mobile { namespace operators { +template <> +bool MulKernel::Init(const MulParam ¶) const { + return true; +} + template <> void MulKernel::Compute(const MulParam ¶m) const { const Tensor *input_x = param.InputX(); diff --git a/src/operators/kernel/arm/multiclass_nms_kernel.cpp b/src/operators/kernel/arm/multiclass_nms_kernel.cpp index 39f55dab38031db14b617e48eedb236eacd1b714..58f224ab536173fff46bb1739b27590382fbab6d 100644 --- a/src/operators/kernel/arm/multiclass_nms_kernel.cpp +++ b/src/operators/kernel/arm/multiclass_nms_kernel.cpp @@ -205,6 +205,12 @@ void MultiClassOutput(const Tensor& scores, const Tensor& bboxes, } } +template <> +bool MultiClassNMSKernel::Init( + const MultiClassNMSParam& para) const { + return true; +} + template <> void MultiClassNMSKernel::Compute( const MultiClassNMSParam& param) const { diff --git a/src/operators/kernel/arm/pool_kernel.cpp b/src/operators/kernel/arm/pool_kernel.cpp index 646f538d7a637b4b009b51b9305d607325a8e54e..09162a13a4d0c59220cc25a02d06369c3f21ed32 100644 --- a/src/operators/kernel/arm/pool_kernel.cpp +++ b/src/operators/kernel/arm/pool_kernel.cpp @@ -35,6 +35,11 @@ inline void PoolBasic(std::string pooling_type, std::vector ksize, } } +template <> +bool PoolKernel::Init(const PoolParam ¶) const { + return true; +} + template <> void PoolKernel::Compute(const PoolParam ¶m) const { const Tensor *in_x = param.Input(); diff --git a/src/operators/kernel/arm/prior_box_kernel.cpp b/src/operators/kernel/arm/prior_box_kernel.cpp index e029c555d4d40745976be45b7a9c022eb62705c7..c14a143ce5d98749c95c780941966944e9ca1249 100644 --- a/src/operators/kernel/arm/prior_box_kernel.cpp +++ b/src/operators/kernel/arm/prior_box_kernel.cpp @@ -28,6 +28,11 @@ struct ClipFunctor { } }; +template <> +bool PriorBoxKernel::Init(const PriorBoxParam ¶) const { + return true; +} + template <> void PriorBoxKernel::Compute(const PriorBoxParam ¶m) const { const auto *input_ = param.Input(); diff --git a/src/operators/kernel/arm/relu_kernel.cpp b/src/operators/kernel/arm/relu_kernel.cpp index 86bf53e5a1e5ecc285c9e9f20cb412d290d535d1..8ec0bfc4fa0c5762418efbd18cda664a1ec43271 100644 --- a/src/operators/kernel/arm/relu_kernel.cpp +++ b/src/operators/kernel/arm/relu_kernel.cpp @@ -27,6 +27,11 @@ struct ReluFunctor { inline T operator()(T in) const { return in > 0 ? in : 0; } }; +template <> +bool ReluKernel::Init(const ReluParam ¶) const { + return true; +} + /* * @b 特化到具体平台的实现, param 从 op 层传入 * */ diff --git a/src/operators/kernel/arm/reshape_kernel.cpp b/src/operators/kernel/arm/reshape_kernel.cpp index 3d40309e97145e1df70f2a4191ee571c4a05627a..8e40dcc987f52265824325af94aa45a1dbdbdb74 100644 --- a/src/operators/kernel/arm/reshape_kernel.cpp +++ b/src/operators/kernel/arm/reshape_kernel.cpp @@ -21,6 +21,11 @@ limitations under the License. */ namespace paddle_mobile { namespace operators { +template <> +bool ReshapeKernel::Init(const ReshapeParam ¶) const { + return true; +} + template <> void ReshapeKernel::Compute(const ReshapeParam ¶m) const { const auto *input_x = param.InputX(); diff --git a/src/operators/kernel/arm/sigmoid_kernel.cpp b/src/operators/kernel/arm/sigmoid_kernel.cpp index 20f275ff482d7073195d075c374e4a0969993714..3f256c69c2ba04de97bb443770c2b460046028e9 100644 --- a/src/operators/kernel/arm/sigmoid_kernel.cpp +++ b/src/operators/kernel/arm/sigmoid_kernel.cpp @@ -71,6 +71,11 @@ void sigmoid(const Tensor *X, Tensor *Y) { #endif } +template <> +bool SigmoidKernel::Init(const SigmoidParam ¶) const { + return true; +} + template <> void SigmoidKernel::Compute(const SigmoidParam ¶m) const { const Tensor *in_x = param.InputX(); diff --git a/src/operators/kernel/arm/softmax_kernel.cpp b/src/operators/kernel/arm/softmax_kernel.cpp index 542283242d09abfbad8830eb0b36136ed35a6ef6..8e966aa0af9ac84b70b154b33bad7dad9e79121d 100644 --- a/src/operators/kernel/arm/softmax_kernel.cpp +++ b/src/operators/kernel/arm/softmax_kernel.cpp @@ -19,6 +19,11 @@ limitations under the License. */ namespace paddle_mobile { namespace operators { +template <> +bool SoftmaxKernel::Init(const SoftmaxParam ¶) const { + return true; +} + template <> void SoftmaxKernel::Compute(const SoftmaxParam ¶m) const { const Tensor *in_x = param.InputX(); diff --git a/src/operators/kernel/arm/transpose_kernel.cpp b/src/operators/kernel/arm/transpose_kernel.cpp index 1b41968f40d036d55b98298a76564dcc12576571..a44ff22a2f228cc357c066a01e142de7cc4f2083 100644 --- a/src/operators/kernel/arm/transpose_kernel.cpp +++ b/src/operators/kernel/arm/transpose_kernel.cpp @@ -34,6 +34,11 @@ namespace operators { // } // } +template <> +bool TransposeKernel::Init(const TransposeParam& para) const { + return true; +} + template <> void TransposeKernel::Compute(const TransposeParam& param) const { const auto* input_x = param.InputX(); diff --git a/src/operators/kernel/batchnorm_kernel.h b/src/operators/kernel/batchnorm_kernel.h index 6c795b2d5e9e7e81fb25d4a1a6dd3ca13c04bd9b..6ef5329bc58fea8bfc17d9115b7004fed2bc4ed7 100644 --- a/src/operators/kernel/batchnorm_kernel.h +++ b/src/operators/kernel/batchnorm_kernel.h @@ -29,6 +29,7 @@ class BatchNormKernel : public framework::OpKernelBase { public: void Compute(const BatchNormParam ¶m) const; + bool Init(const BatchNormParam ¶) const; }; } // namespace operators diff --git a/src/operators/kernel/box_coder_kernel.h b/src/operators/kernel/box_coder_kernel.h index 1c612b373cd086fcd566fe69e71eb77e4d1a30b6..4c4206f52b3ffc5e60983bf1d6adb25292d01ac4 100644 --- a/src/operators/kernel/box_coder_kernel.h +++ b/src/operators/kernel/box_coder_kernel.h @@ -30,6 +30,7 @@ class BoxCoderKernel : public framework::OpKernelBase { public: void Compute(const BoxCoderParam& param) const; + bool Init(const BoxCoderParam& para) const; }; } // namespace operators } // namespace paddle_mobile diff --git a/src/operators/kernel/concat_kernel.h b/src/operators/kernel/concat_kernel.h index 3b649974e8bb670b7ec81c61f185a2d8f9b24ad0..6a7b7c6005b6e85e5b1ccfee713672b6e333b98a 100644 --- a/src/operators/kernel/concat_kernel.h +++ b/src/operators/kernel/concat_kernel.h @@ -27,6 +27,7 @@ template class ConcatKernel : public framework::OpKernelBase { public: void Compute(const ConcatParam ¶m) const; + bool Init(const ConcatParam ¶) const; }; } // namespace operators diff --git a/src/operators/kernel/conv_add_kernel.h b/src/operators/kernel/conv_add_kernel.h index 63086ea25f4ba97295a2f243366c37b66dfed0b5..8f733f245dc26664ce38413a09fc5404029cdd2f 100644 --- a/src/operators/kernel/conv_add_kernel.h +++ b/src/operators/kernel/conv_add_kernel.h @@ -38,6 +38,7 @@ template class ConvAddKernel : public OpKernelBase { public: void Compute(const FusionConvAddParam ¶m) const; + bool Init(const FusionConvAddParam ¶) const; }; } // namespace operators diff --git a/src/operators/kernel/conv_add_relu_kernel.h b/src/operators/kernel/conv_add_relu_kernel.h index ed2cc896f438220468c074b742ffa7e12779a63e..9b86cd22e82e641ee6cb0a15bd25c8a1c6cbe8cb 100644 --- a/src/operators/kernel/conv_add_relu_kernel.h +++ b/src/operators/kernel/conv_add_relu_kernel.h @@ -36,6 +36,7 @@ class ConvAddReluKernel : public OpKernelBase { public: void Compute(const FusionConvAddReluParam ¶m) const; + bool Init(const FusionConvAddReluParam ¶) const; }; } // namespace operators diff --git a/src/operators/kernel/conv_kernel.h b/src/operators/kernel/conv_kernel.h index 06c0c2c55629d9762cffa0b2c5572050b95bc771..8efdc0bc067927d4a0f0d7fcef56d8a732e0b848 100644 --- a/src/operators/kernel/conv_kernel.h +++ b/src/operators/kernel/conv_kernel.h @@ -32,6 +32,7 @@ template class ConvKernel : public OpKernelBase { public: void Compute(const ConvParam ¶m) const; + bool Init(const ConvParam ¶) const; }; inline bool IsExpand(const std::vector &filter_dim, diff --git a/src/operators/kernel/depthwise_conv_kernel.h b/src/operators/kernel/depthwise_conv_kernel.h index 1ef76a573e27ff09fe7842ad78e9fe6042a742a1..a8a8fb338620477670477703018bf9e6e9a8a604 100644 --- a/src/operators/kernel/depthwise_conv_kernel.h +++ b/src/operators/kernel/depthwise_conv_kernel.h @@ -31,6 +31,7 @@ template class DepthwiseConvKernel : public OpKernelBase { public: void Compute(const ConvParam ¶m) const; + bool Init(const ConvParam ¶) const; }; } // namespace operators } // namespace paddle_mobile diff --git a/src/operators/kernel/elementwise_add_kernel.h b/src/operators/kernel/elementwise_add_kernel.h index 7a2f92120105b9f9539937e00c392c0eb77e3830..fe6a0238dcd5249e822de3b5930438df808bf853 100644 --- a/src/operators/kernel/elementwise_add_kernel.h +++ b/src/operators/kernel/elementwise_add_kernel.h @@ -30,6 +30,7 @@ class ElementwiseAddKernel : public framework::OpKernelBase { public: void Compute(const ElementwiseAddParam ¶m) const; + bool Init(const ElementwiseAddParam ¶) const; }; } // namespace operators } // namespace paddle_mobile diff --git a/src/operators/kernel/fpga/conv_kernel.cpp b/src/operators/kernel/fpga/conv_kernel.cpp index d2c08992a89f0837de318c876fbab2892ee34e89..30dd64fd1466902036a72faa4be5d359d2bdb0bf 100644 --- a/src/operators/kernel/fpga/conv_kernel.cpp +++ b/src/operators/kernel/fpga/conv_kernel.cpp @@ -19,6 +19,11 @@ limitations under the License. */ namespace paddle_mobile { namespace operators { +template <> +bool ConvKernel::Init(const ConvParam ¶) const { + return true; +} + template <> void ConvKernel::Compute(const ConvParam ¶m) const {} template class ConvKernel; diff --git a/src/operators/kernel/fusion_fc_kernel.h b/src/operators/kernel/fusion_fc_kernel.h index cbb9721c7fc810cbb9feb56160dc71660f3f4489..c4e2b30176fb904d7fb906c5efc5137a5dcb8d59 100644 --- a/src/operators/kernel/fusion_fc_kernel.h +++ b/src/operators/kernel/fusion_fc_kernel.h @@ -28,6 +28,7 @@ class FusionFcKernel : public framework::OpKernelBase { public: void Compute(const FusionFcParam& param) const; + bool Init(const FusionFcParam& para) const; }; } // namespace operators } // namespace paddle_mobile diff --git a/src/operators/kernel/lrn_kernel.h b/src/operators/kernel/lrn_kernel.h index d92d15e5e9d22c431799e924ef1b5ba0de840004..3b4b34250ef376032299bf14b2d4e2074e46245d 100644 --- a/src/operators/kernel/lrn_kernel.h +++ b/src/operators/kernel/lrn_kernel.h @@ -169,6 +169,7 @@ template class LrnKernel : public framework::OpKernelBase { public: void Compute(const LrnParam ¶m) const; + bool Init(const LrnParam ¶) const; }; } // namespace operators } // namespace paddle_mobile diff --git a/src/operators/kernel/mali/batchnorm_kernel.cpp b/src/operators/kernel/mali/batchnorm_kernel.cpp index 5ad6d6f015c9d8ec095f8269642dd72f4d0a56a1..8f9381ce722ee37c14b3a1a29d7de990f17e8e3a 100644 --- a/src/operators/kernel/mali/batchnorm_kernel.cpp +++ b/src/operators/kernel/mali/batchnorm_kernel.cpp @@ -21,6 +21,11 @@ limitations under the License. */ namespace paddle_mobile { namespace operators { +template <> +bool BatchNormKernel::Init(const BatchNormParam ¶) const { + return true; +} + template <> void BatchNormKernel::Compute( const BatchNormParam ¶m) const {} diff --git a/src/operators/kernel/mali/conv_kernel.cpp b/src/operators/kernel/mali/conv_kernel.cpp index c6bb6306b714fe511695e1b47a5e63c611eca465..a98b9d8bdf2748d6bb942aa1ab3dbd76ffdad913 100644 --- a/src/operators/kernel/mali/conv_kernel.cpp +++ b/src/operators/kernel/mali/conv_kernel.cpp @@ -19,6 +19,11 @@ limitations under the License. */ namespace paddle_mobile { namespace operators { +template <> +bool ConvKernel::Init(const ConvParam ¶) const { + return true; +} + template <> void ConvKernel::Compute(const ConvParam ¶m) const { // ArmConvImplement imp; diff --git a/src/operators/kernel/mul_kernel.h b/src/operators/kernel/mul_kernel.h index 4ca1df1af188b4e9b95644d0796a7968f873f6f4..81db202c2d26fae9abb971a2cafe32f9b20dfe22 100644 --- a/src/operators/kernel/mul_kernel.h +++ b/src/operators/kernel/mul_kernel.h @@ -29,6 +29,7 @@ template class MulKernel : public framework::OpKernelBase { public: void Compute(const MulParam ¶m) const; + bool Init(const MulParam ¶) const; }; } // namespace operators } // namespace paddle_mobile diff --git a/src/operators/kernel/multiclass_nms_kernel.h b/src/operators/kernel/multiclass_nms_kernel.h index 82bafe2685423f8014d95b8fc875554567d2094a..ca86604f2c6e550c219e54b6533c1500fb2912c4 100644 --- a/src/operators/kernel/multiclass_nms_kernel.h +++ b/src/operators/kernel/multiclass_nms_kernel.h @@ -28,6 +28,7 @@ class MultiClassNMSKernel : public framework::OpKernelBase { public: void Compute(const MultiClassNMSParam& param) const; + bool Init(const MultiClassNMSParam& para) const; }; } // namespace operators } // namespace paddle_mobile diff --git a/src/operators/kernel/pool_kernel.h b/src/operators/kernel/pool_kernel.h index 2a7b0ec48edeb922d6701e6ce4a9b6a514bc58f7..3285f56cc01fad554bff7e6a4d25769f8ef56d24 100644 --- a/src/operators/kernel/pool_kernel.h +++ b/src/operators/kernel/pool_kernel.h @@ -28,6 +28,7 @@ template class PoolKernel : public OpKernelBase { public: void Compute(const PoolParam ¶m) const override; + bool Init(const PoolParam ¶) const; }; } // namespace operators } // namespace paddle_mobile diff --git a/src/operators/kernel/prior_box_kernel.h b/src/operators/kernel/prior_box_kernel.h index 3e7c72a736ea56beb6cede1d5892675d6721163f..be13f0fc16c0c0c0b16117a46b80a9f9acdeffae 100644 --- a/src/operators/kernel/prior_box_kernel.h +++ b/src/operators/kernel/prior_box_kernel.h @@ -54,6 +54,7 @@ class PriorBoxKernel : public framework::OpKernelBase { public: void Compute(const PriorBoxParam& param) const; + bool Init(const PriorBoxParam& para) const; }; } // namespace operators } // namespace paddle_mobile diff --git a/src/operators/kernel/relu_kernel.h b/src/operators/kernel/relu_kernel.h index 793268f35a78255f853c85d1af0d2ef0d3d328e5..2155c33811f553435e4a89b5b23533e2bd42db5d 100644 --- a/src/operators/kernel/relu_kernel.h +++ b/src/operators/kernel/relu_kernel.h @@ -27,6 +27,7 @@ template class ReluKernel : public framework::OpKernelBase { public: void Compute(const ReluParam& param) const; + bool Init(const ReluParam& para) const; }; } // namespace operators } // namespace paddle_mobile diff --git a/src/operators/kernel/reshape_kernel.h b/src/operators/kernel/reshape_kernel.h index 6b153e5fe3eba73f548fd1fc0ab9f95a5b390bf1..364f5b0902c2661017f2e72520849836f64dd0bb 100644 --- a/src/operators/kernel/reshape_kernel.h +++ b/src/operators/kernel/reshape_kernel.h @@ -71,6 +71,7 @@ template class ReshapeKernel : public framework::OpKernelBase { public: void Compute(const ReshapeParam& param) const; + bool Init(const ReshapeParam& para) const; }; } // namespace operators } // namespace paddle_mobile diff --git a/src/operators/kernel/sigmoid_kernel.h b/src/operators/kernel/sigmoid_kernel.h index e901f02096c764537f268f628ccdc379f3a503e1..e9eaae5ad867c6880db7346f9632ff37a92aaf66 100644 --- a/src/operators/kernel/sigmoid_kernel.h +++ b/src/operators/kernel/sigmoid_kernel.h @@ -26,6 +26,7 @@ template class SigmoidKernel : public OpKernelBase { public: void Compute(const SigmoidParam& param) const override; + bool Init(const SigmoidParam& para) const; }; } // namespace operators } // namespace paddle_mobile diff --git a/src/operators/kernel/softmax_kernel.h b/src/operators/kernel/softmax_kernel.h index 2b2d753cf666a6eb58f70f2f43afbbefb3953d8b..a7a7666e32ef1923a47d71d94c93e813a23028c5 100644 --- a/src/operators/kernel/softmax_kernel.h +++ b/src/operators/kernel/softmax_kernel.h @@ -29,6 +29,7 @@ template class SoftmaxKernel : public OpKernelBase { public: void Compute(const SoftmaxParam ¶m) const override; + bool Init(const SoftmaxParam ¶) const; }; } // namespace operators } // namespace paddle_mobile diff --git a/src/operators/kernel/transpose_kernel.h b/src/operators/kernel/transpose_kernel.h index 82d73ac82cd28edbd5b6fc349748293fd00fcf45..6526d97df9863392f783841a784cb5df4e45f218 100644 --- a/src/operators/kernel/transpose_kernel.h +++ b/src/operators/kernel/transpose_kernel.h @@ -29,6 +29,7 @@ class TransposeKernel : public framework::OpKernelBase { public: void Compute(const TransposeParam& param) const; + bool Init(const TransposeParam& para) const; }; } // namespace operators } // namespace paddle_mobile