From ac318c202614aa55b7da9f580afffbf399a5fce8 Mon Sep 17 00:00:00 2001 From: liuruilong Date: Mon, 11 Jun 2018 19:07:29 +0800 Subject: [PATCH] for --- CMakeLists.txt | 14 ++++- src/framework/op_registry.h | 69 +++++++++++++++++++---- src/framework/operator.cpp | 5 ++ src/framework/operator.h | 2 + src/operators/batchnorm_op.cpp | 11 +++- src/operators/box_coder_op.cpp | 10 +++- src/operators/concat_op.cpp | 11 +++- src/operators/conv_op.cpp | 16 +++++- src/operators/depthwise_conv_op.cpp | 10 +++- src/operators/elementwise_add_op.cpp | 10 +++- src/operators/feed_op.h | 10 +++- src/operators/fetch_op.h | 10 +++- src/operators/fusion_conv_add.cpp | 10 +++- src/operators/fusion_conv_add.h | 8 ++- src/operators/fusion_conv_add_relu_op.h | 10 +++- src/operators/fusion_fc_op.cpp | 10 +++- src/operators/fusion_fc_op.h | 9 ++- src/operators/kernel/fpga/conv_kernel.cpp | 11 ++-- src/operators/lrn_op.cpp | 10 +++- src/operators/mul_op.cpp | 10 +++- src/operators/multiclass_nms_op.cpp | 10 +++- src/operators/pool_op.cpp | 10 +++- src/operators/prior_box_op.cpp | 10 +++- src/operators/relu_op.cpp | 10 +++- src/operators/reshape_op.cpp | 10 +++- src/operators/sigmoid_op.cpp | 10 +++- src/operators/softmax_op.cpp | 10 +++- src/operators/transpose_op.cpp | 11 +++- 28 files changed, 276 insertions(+), 61 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e6d7fad6f2..fd789303a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,10 +1,22 @@ cmake_minimum_required(VERSION 3.0) project(paddle-mobile) -option(DEBUGING "enable debug mode" OFF) +option(DEBUGING "enable debug mode" ON) option(USE_OPENMP "openmp support" OFF) option(USE_EXCEPTION "use std exception" ON) +option(CPU "cpu" ON) +option(MALI_GPU "mali gpu" OFF) +option(FPGA "fpga" ON) + +if (CPU) + add_definitions(-DPADDLE_MOBILE_CPU) +elseif (MALI_GPU) + add_definitions(-DPADDLE_MOBILE_MALI_GPU) +elseif(FPGA) + add_definitions(-DPADDLE_MOBILE_FPGA) +endif() + if (DEBUGING) set(CMAKE_BUILD_TYPE Debug) else() diff --git a/src/framework/op_registry.h b/src/framework/op_registry.h index 62398dcb15..74a4b27250 100644 --- a/src/framework/op_registry.h +++ b/src/framework/op_registry.h @@ -96,24 +96,73 @@ class OpRegistry { } }; -#define REGISTER_OPERATOR(op_type, op_class) \ +#ifdef PADDLE_MOBILE_CPU + +#define REGISTER_OPERATOR_CPU(op_type, op_class) \ template \ - class _OpClass_##op_type##_ : public op_class { \ + class _OpClass_##op_type##_cpu : public op_class { \ public: \ - DEFINE_OP_CONSTRUCTOR(_OpClass_##op_type##_, op_class); \ + DEFINE_OP_CONSTRUCTOR(_OpClass_##op_type##_cpu, op_class); \ }; \ static paddle_mobile::framework::OperatorRegistrar< \ - paddle_mobile::CPU, _OpClass_##op_type##_> \ - __op_registrar_##op_type##__(#op_type); \ - int TouchOpRegistrar_##op_type() { \ - __op_registrar_##op_type##__.Touch(); \ + paddle_mobile::CPU, _OpClass_##op_type##_cpu> \ + __op_registrar_##op_type##__cpu(#op_type); \ + int TouchOpRegistrar_##op_type##_cpu() { \ + __op_registrar_##op_type##__cpu.Touch(); \ return 0; \ } -#define USE_OP(op_type) \ - extern int TouchOpRegistrar_##op_type(); \ +#define USE_OP_CPU(op_type) \ + extern int TouchOpRegistrar_##op_type##_cpu(); \ static int use_op_itself_##op_type##_ __attribute__((unused)) = \ - TouchOpRegistrar_##op_type() + TouchOpRegistrar_##op_type##_cpu() + +#endif + + +#ifdef PADDLE_MOBILE_MALI_GPU +#define REGISTER_OPERATOR_MALI_GPU(op_type, op_class) \ + template \ + class _OpClass_##op_type##_mali_gpu : public op_class { \ + public: \ + DEFINE_OP_CONSTRUCTOR(_OpClass_##op_type##_mali_gpu, op_class); \ + }; \ + static paddle_mobile::framework::OperatorRegistrar< \ + paddle_mobile::CPU, _OpClass_##op_type##_mali_gpu> \ + __op_registrar_##op_type##__mali_gpu(#op_type); \ + int TouchOpRegistrar_##op_type##_mali_gpu() { \ + __op_registrar_##op_type##__mali_gpu.Touch(); \ + return 0; \ + } + +#define USE_OP_MALI_GPU(op_type) \ + extern int TouchOpRegistrar_##op_type##_mali_gpu(); \ + static int use_op_itself_##op_type##_ __attribute__((unused)) = \ + TouchOpRegistrar_##op_type##_mali_gpu() + +#endif + +#ifdef PADDLE_MOBILE_FPGA +#define REGISTER_OPERATOR_FPGA(op_type, op_class) \ + template \ + class _OpClass_##op_type##_fpga : public op_class { \ + public: \ + DEFINE_OP_CONSTRUCTOR(_OpClass_##op_type##_fpga, op_class); \ + }; \ + static paddle_mobile::framework::OperatorRegistrar< \ + paddle_mobile::CPU, _OpClass_##op_type##_fpga> \ + __op_registrar_##op_type##__fpga(#op_type); \ + int TouchOpRegistrar_##op_type##_fpga() { \ + __op_registrar_##op_type##__fpga.Touch(); \ + return 0; \ + } + +#define USE_OP_FPGA(op_type) \ + extern int TouchOpRegistrar_##op_type##_fpga(); \ + static int use_op_itself_##op_type##_ __attribute__((unused)) = \ + TouchOpRegistrar_##op_type##_fpga() + +#endif } // namespace framework } // namespace paddle_mobile diff --git a/src/framework/operator.cpp b/src/framework/operator.cpp index f798d7ade2..0e8d6f9780 100644 --- a/src/framework/operator.cpp +++ b/src/framework/operator.cpp @@ -58,7 +58,12 @@ void OperatorBase::Run() const { } template class OperatorBase; +template class OperatorBase; +template class OperatorBase; + template class OperatorWithKernel; +template class OperatorWithKernel; +template class OperatorWithKernel; } // namespace framework } // namespace paddle_mobile diff --git a/src/framework/operator.h b/src/framework/operator.h index d9b74e8887..c49f850855 100644 --- a/src/framework/operator.h +++ b/src/framework/operator.h @@ -137,6 +137,7 @@ class OpKernelBase { std::shared_ptr<::paddle_mobile::framework::Scope> scope) \ : parent_cls(type, inputs, outputs, attrs, scope) {} + class FusionOpMatcher { public: FusionOpMatcher() {} @@ -153,6 +154,7 @@ class FusionOpMatcher { std::string BeginType() { return node_.Type(); } + // virtual bool Fusion(); protected: Node node_; std::string type_; diff --git a/src/operators/batchnorm_op.cpp b/src/operators/batchnorm_op.cpp index 0de5111d06..896e677e14 100644 --- a/src/operators/batchnorm_op.cpp +++ b/src/operators/batchnorm_op.cpp @@ -31,7 +31,14 @@ template class BatchNormOp; } // namespace paddle_mobile namespace ops = paddle_mobile::operators; -USE_OP(batch_norm); -REGISTER_OPERATOR(batch_norm, ops::BatchNormOp); +#ifdef PADDLE_MOBILE_CPU +USE_OP_CPU(batch_norm); +REGISTER_OPERATOR_CPU(batch_norm, ops::BatchNormOp); +#endif +#ifdef PADDLE_MOBILE_MALI_GPU +#endif +#ifdef PADDLE_MOBILE_FPGA +#endif + #endif diff --git a/src/operators/box_coder_op.cpp b/src/operators/box_coder_op.cpp index 22d006a258..8dc5da43d0 100644 --- a/src/operators/box_coder_op.cpp +++ b/src/operators/box_coder_op.cpp @@ -52,7 +52,13 @@ template class BoxCoderOp; } // namespace paddle_mobile namespace ops = paddle_mobile::operators; -USE_OP(box_coder); -REGISTER_OPERATOR(box_coder, ops::BoxCoderOp); +#ifdef PADDLE_MOBILE_CPU +USE_OP_CPU(box_coder); +REGISTER_OPERATOR_CPU(box_coder, ops::BoxCoderOp); +#endif +#ifdef PADDLE_MOBILE_MALI_GPU +#endif +#ifdef PADDLE_MOBILE_FPGA +#endif #endif diff --git a/src/operators/concat_op.cpp b/src/operators/concat_op.cpp index 26f5e7d4e4..a128629e77 100644 --- a/src/operators/concat_op.cpp +++ b/src/operators/concat_op.cpp @@ -61,8 +61,15 @@ template class ConcatOp; } // namespace operators } // namespace paddle_mobile + namespace ops = paddle_mobile::operators; -USE_OP(concat); -REGISTER_OPERATOR(concat, ops::ConcatOp); +#ifdef PADDLE_MOBILE_CPU +USE_OP_CPU(concat); +REGISTER_OPERATOR_CPU(concat, ops::ConcatOp); +#endif +#ifdef PADDLE_MOBILE_MALI_GPU +#endif +#ifdef PADDLE_MOBILE_FPGA +#endif #endif diff --git a/src/operators/conv_op.cpp b/src/operators/conv_op.cpp index c8ec33333f..7b06a29fe9 100644 --- a/src/operators/conv_op.cpp +++ b/src/operators/conv_op.cpp @@ -53,7 +53,19 @@ template class ConvOp; } // namespace paddle_mobile namespace ops = paddle_mobile::operators; -USE_OP(conv2d); -REGISTER_OPERATOR(conv2d, ops::ConvOp); +#ifdef PADDLE_MOBILE_CPU +USE_OP_CPU(conv2d); +REGISTER_OPERATOR_CPU(conv2d, ops::ConvOp); +#endif +#ifdef PADDLE_MOBILE_MALI_GPU +USE_OP_MALI_GPU(conv2d); +REGISTER_OPERATOR_MALI_GPU(conv2d, ops::ConvOp); +#endif +#ifdef PADDLE_MOBILE_FPGA +USE_OP_FPGA(conv2d); +REGISTER_OPERATOR_FPGA(conv2d, ops::ConvOp); +#endif + + #endif diff --git a/src/operators/depthwise_conv_op.cpp b/src/operators/depthwise_conv_op.cpp index 87c9746b4d..55198fd116 100644 --- a/src/operators/depthwise_conv_op.cpp +++ b/src/operators/depthwise_conv_op.cpp @@ -54,7 +54,13 @@ template class DepthwiseConvOp; } // namespace paddle_mobile namespace ops = paddle_mobile::operators; -USE_OP(depthwise_conv2d); -REGISTER_OPERATOR(depthwise_conv2d, ops::DepthwiseConvOp); +#ifdef PADDLE_MOBILE_CPU +USE_OP_CPU(depthwise_conv2d); +REGISTER_OPERATOR_CPU(depthwise_conv2d, ops::DepthwiseConvOp); +#endif +#ifdef PADDLE_MOBILE_MALI_GPU +#endif +#ifdef PADDLE_MOBILE_FPGA +#endif #endif diff --git a/src/operators/elementwise_add_op.cpp b/src/operators/elementwise_add_op.cpp index ff2cd25988..5333dcfdb6 100644 --- a/src/operators/elementwise_add_op.cpp +++ b/src/operators/elementwise_add_op.cpp @@ -29,7 +29,13 @@ template class ElementwiseAddOp; } // namespace paddle_mobile namespace ops = paddle_mobile::operators; -USE_OP(elementwise_add); -REGISTER_OPERATOR(elementwise_add, ops::ElementwiseAddOp); +#ifdef PADDLE_MOBILE_CPU +USE_OP_CPU(elementwise_add); +REGISTER_OPERATOR_CPU(elementwise_add, ops::ElementwiseAddOp); +#endif +#ifdef PADDLE_MOBILE_MALI_GPU +#endif +#ifdef PADDLE_MOBILE_FPGA +#endif #endif diff --git a/src/operators/feed_op.h b/src/operators/feed_op.h index 25a82894ea..9079dbb0b3 100644 --- a/src/operators/feed_op.h +++ b/src/operators/feed_op.h @@ -43,8 +43,14 @@ class FeedOp : public framework::OperatorBase { }; namespace ops = paddle_mobile::operators; -USE_OP(feed); -REGISTER_OPERATOR(feed, ops::FeedOp); +#ifdef PADDLE_MOBILE_CPU +USE_OP_CPU(feed); +REGISTER_OPERATOR_CPU(feed, ops::FeedOp); +#endif +#ifdef PADDLE_MOBILE_MALI_GPU +#endif +#ifdef PADDLE_MOBILE_FPGA +#endif } // namespace operators } // namespace paddle_mobile diff --git a/src/operators/fetch_op.h b/src/operators/fetch_op.h index 31e17f2b56..a65338f7f4 100644 --- a/src/operators/fetch_op.h +++ b/src/operators/fetch_op.h @@ -43,8 +43,14 @@ class FetchOp : public framework::OperatorBase { }; namespace ops = paddle_mobile::operators; -USE_OP(fetch); -REGISTER_OPERATOR(fetch, ops::FetchOp); +#ifdef PADDLE_MOBILE_CPU +USE_OP_CPU(fetch); +REGISTER_OPERATOR_CPU(fetch, ops::FetchOp); +#endif +#ifdef PADDLE_MOBILE_MALI_GPU +#endif +#ifdef PADDLE_MOBILE_FPGA +#endif } // namespace operators } // namespace paddle_mobile diff --git a/src/operators/fusion_conv_add.cpp b/src/operators/fusion_conv_add.cpp index fe380bddca..97867a9728 100644 --- a/src/operators/fusion_conv_add.cpp +++ b/src/operators/fusion_conv_add.cpp @@ -25,7 +25,13 @@ template class FushionConvAddOp; } // namespace paddle_mobile namespace ops = paddle_mobile::operators; -USE_OP(conv_add); -REGISTER_OPERATOR(conv_add, ops::FushionConvAddOp); +#ifdef PADDLE_MOBILE_CPU +USE_OP_CPU(conv_add); +REGISTER_OPERATOR_CPU(conv_add, ops::FushionConvAddOp); +#endif +#ifdef PADDLE_MOBILE_MALI_GPU +#endif +#ifdef PADDLE_MOBILE_FPGA +#endif #endif diff --git a/src/operators/fusion_conv_add.h b/src/operators/fusion_conv_add.h index 1e6a84b1dc..5293b213a0 100644 --- a/src/operators/fusion_conv_add.h +++ b/src/operators/fusion_conv_add.h @@ -64,7 +64,13 @@ class FushionConvAddOp : public framework::OperatorWithKernel { // FushionFcParam param_; }; -// static framework::FusionOpRegistrar fc_registrar(new FusionConvAddMatcher()); +#ifdef PADDLE_MOBILE_CPU +static framework::FusionOpRegistrar fc_registrar(new FusionConvAddMatcher()); +#endif +#ifdef PADDLE_MOBILE_MALI_GPU +#endif +#ifdef PADDLE_MOBILE_FPGA +#endif } // namespace operators } // namespace paddle_mobile diff --git a/src/operators/fusion_conv_add_relu_op.h b/src/operators/fusion_conv_add_relu_op.h index 4825a01be9..601486f209 100644 --- a/src/operators/fusion_conv_add_relu_op.h +++ b/src/operators/fusion_conv_add_relu_op.h @@ -46,8 +46,14 @@ class ConvAddReluOp { private: }; -// static framework::FusionOpRegistrar fc_registrar( -// new FushionConvAddReluOpMatcher()); +#ifdef PADDLE_MOBILE_CPU +//static framework::FusionOpRegistrar fusion_conv_add_relu_registrar( +// new FushionConvAddReluOpMatcher()); +#endif +#ifdef PADDLE_MOBILE_MALI_GPU +#endif +#ifdef PADDLE_MOBILE_FPGA +#endif } // namespace operators } // namespace paddle_mobile diff --git a/src/operators/fusion_fc_op.cpp b/src/operators/fusion_fc_op.cpp index 8f639e212a..c85de86202 100644 --- a/src/operators/fusion_fc_op.cpp +++ b/src/operators/fusion_fc_op.cpp @@ -54,7 +54,13 @@ template class FushionFcOp; } // namespace paddle_mobile namespace ops = paddle_mobile::operators; -USE_OP(fc); -REGISTER_OPERATOR(fc, ops::FushionFcOp); +#ifdef PADDLE_MOBILE_CPU +USE_OP_CPU(fc); +REGISTER_OPERATOR_CPU(fc, ops::FushionFcOp); +#endif +#ifdef PADDLE_MOBILE_MALI_GPU +#endif +#ifdef PADDLE_MOBILE_FPGA +#endif #endif diff --git a/src/operators/fusion_fc_op.h b/src/operators/fusion_fc_op.h index 4420eac58b..839ef07b24 100644 --- a/src/operators/fusion_fc_op.h +++ b/src/operators/fusion_fc_op.h @@ -37,8 +37,6 @@ class FusionFcMatcher : public framework::FusionOpMatcher { void FolderNodes( framework::Node *node, std::vector> *removed_nodes) { - vector> origin_descs = - node->OpDescs(node_.Depth()); node->Folder(node_.Depth(), Type(), {{G_OP_TYPE_ELEMENTWISE_ADD, {"Y", "Z"}}}, removed_nodes); } @@ -69,7 +67,14 @@ class FushionFcOp : public framework::OperatorWithKernel { FushionFcParam param_; }; +#ifdef PADDLE_MOBILE_CPU static framework::FusionOpRegistrar fc_registrar(new FusionFcMatcher()); +#endif +#ifdef PADDLE_MOBILE_MALI_GPU +static framework::FusionOpRegistrar fc_registrar(new FusionFcMatcher()); +#endif +#ifdef PADDLE_MOBILE_FPGA +#endif } // namespace operators } // namespace paddle_mobile diff --git a/src/operators/kernel/fpga/conv_kernel.cpp b/src/operators/kernel/fpga/conv_kernel.cpp index 21badb0d8e..00a7e4a3d6 100644 --- a/src/operators/kernel/fpga/conv_kernel.cpp +++ b/src/operators/kernel/fpga/conv_kernel.cpp @@ -14,14 +14,15 @@ limitations under the License. */ #ifdef CONV_OP +#include "operators/kernel/conv_kernel.h" + namespace paddle_mobile { namespace operators { -// template<> -// void ConvKernel::Compute(const ConvParam ¶m) const -// {} -// -// template class ConvKernel; +template<> +void ConvKernel::Compute(const ConvParam ¶m) const {} +template class ConvKernel; + } } // namespace paddle_mobile diff --git a/src/operators/lrn_op.cpp b/src/operators/lrn_op.cpp index f072b22b06..d159cdf21b 100644 --- a/src/operators/lrn_op.cpp +++ b/src/operators/lrn_op.cpp @@ -29,7 +29,13 @@ template class LrnOp; } // namespace paddle_mobile namespace ops = paddle_mobile::operators; -USE_OP(lrn); -REGISTER_OPERATOR(lrn, ops::LrnOp); +#ifdef PADDLE_MOBILE_CPU +USE_OP_CPU(lrn); +REGISTER_OPERATOR_CPU(lrn, ops::LrnOp); +#endif +#ifdef PADDLE_MOBILE_MALI_GPU +#endif +#ifdef PADDLE_MOBILE_FPGA +#endif #endif diff --git a/src/operators/mul_op.cpp b/src/operators/mul_op.cpp index 2bd2e06944..d33bcbfddd 100644 --- a/src/operators/mul_op.cpp +++ b/src/operators/mul_op.cpp @@ -55,7 +55,13 @@ template class MulOp; } // namespace paddle_mobile namespace ops = paddle_mobile::operators; -USE_OP(mul); -REGISTER_OPERATOR(mul, ops::MulOp); +#ifdef PADDLE_MOBILE_CPU +USE_OP_CPU(mul); +REGISTER_OPERATOR_CPU(mul, ops::MulOp); +#endif +#ifdef PADDLE_MOBILE_MALI_GPU +#endif +#ifdef PADDLE_MOBILE_FPGA +#endif #endif diff --git a/src/operators/multiclass_nms_op.cpp b/src/operators/multiclass_nms_op.cpp index 1e4c3f8c34..e8b5f195fe 100644 --- a/src/operators/multiclass_nms_op.cpp +++ b/src/operators/multiclass_nms_op.cpp @@ -39,7 +39,13 @@ template class MultiClassNMSOp; } // namespace paddle_mobile namespace ops = paddle_mobile::operators; -USE_OP(multiclass_nms); -REGISTER_OPERATOR(multiclass_nms, ops::MultiClassNMSOp); +#ifdef PADDLE_MOBILE_CPU +USE_OP_CPU(multiclass_nms); +REGISTER_OPERATOR_CPU(multiclass_nms, ops::MultiClassNMSOp); +#endif +#ifdef PADDLE_MOBILE_MALI_GPU +#endif +#ifdef PADDLE_MOBILE_FPGA +#endif #endif diff --git a/src/operators/pool_op.cpp b/src/operators/pool_op.cpp index 45a709d207..79b06174af 100644 --- a/src/operators/pool_op.cpp +++ b/src/operators/pool_op.cpp @@ -59,7 +59,13 @@ template class PoolOp; } // namespace paddle_mobile namespace ops = paddle_mobile::operators; -USE_OP(pool2d); -REGISTER_OPERATOR(pool2d, ops::PoolOp); +#ifdef PADDLE_MOBILE_CPU +USE_OP_CPU(pool2d); +REGISTER_OPERATOR_CPU(pool2d, ops::PoolOp); +#endif +#ifdef PADDLE_MOBILE_MALI_GPU +#endif +#ifdef PADDLE_MOBILE_FPGA +#endif #endif diff --git a/src/operators/prior_box_op.cpp b/src/operators/prior_box_op.cpp index 22f9326b00..f3ae6e5231 100644 --- a/src/operators/prior_box_op.cpp +++ b/src/operators/prior_box_op.cpp @@ -49,7 +49,13 @@ template class PriorBoxOp; } // namespace paddle_mobile namespace ops = paddle_mobile::operators; -USE_OP(prior_box); -REGISTER_OPERATOR(prior_box, ops::PriorBoxOp); +#ifdef PADDLE_MOBILE_CPU +USE_OP_CPU(prior_box); +REGISTER_OPERATOR_CPU(prior_box, ops::PriorBoxOp); +#endif +#ifdef PADDLE_MOBILE_MALI_GPU +#endif +#ifdef PADDLE_MOBILE_FPGA +#endif #endif diff --git a/src/operators/relu_op.cpp b/src/operators/relu_op.cpp index 3beac26093..066772e3be 100644 --- a/src/operators/relu_op.cpp +++ b/src/operators/relu_op.cpp @@ -33,7 +33,13 @@ template class ReluOp; * 都是需要和model中类型对应起来的 * */ namespace ops = paddle_mobile::operators; -USE_OP(relu); -REGISTER_OPERATOR(relu, ops::ReluOp); +#ifdef PADDLE_MOBILE_CPU +USE_OP_CPU(relu); +REGISTER_OPERATOR_CPU(relu, ops::ReluOp); +#endif +#ifdef PADDLE_MOBILE_MALI_GPU +#endif +#ifdef PADDLE_MOBILE_FPGA +#endif #endif diff --git a/src/operators/reshape_op.cpp b/src/operators/reshape_op.cpp index 44d3de2203..5d0aa49a26 100644 --- a/src/operators/reshape_op.cpp +++ b/src/operators/reshape_op.cpp @@ -32,7 +32,13 @@ template class ReshapeOp; } // namespace paddle_mobile namespace ops = paddle_mobile::operators; -USE_OP(reshape); -REGISTER_OPERATOR(reshape, ops::ReshapeOp); +#ifdef PADDLE_MOBILE_CPU +USE_OP_CPU(reshape); +REGISTER_OPERATOR_CPU(reshape, ops::ReshapeOp); +#endif +#ifdef PADDLE_MOBILE_MALI_GPU +#endif +#ifdef PADDLE_MOBILE_FPGA +#endif #endif diff --git a/src/operators/sigmoid_op.cpp b/src/operators/sigmoid_op.cpp index 8be9309d10..641b6f29f2 100644 --- a/src/operators/sigmoid_op.cpp +++ b/src/operators/sigmoid_op.cpp @@ -27,7 +27,13 @@ template class SigmoidOp; } // namespace paddle_mobile namespace ops = paddle_mobile::operators; -USE_OP(sigmoid); -REGISTER_OPERATOR(sigmoid, ops::SigmoidOp); +#ifdef PADDLE_MOBILE_CPU +USE_OP_CPU(sigmoid); +REGISTER_OPERATOR_CPU(sigmoid, ops::SigmoidOp); +#endif +#ifdef PADDLE_MOBILE_MALI_GPU +#endif +#ifdef PADDLE_MOBILE_FPGA +#endif #endif diff --git a/src/operators/softmax_op.cpp b/src/operators/softmax_op.cpp index 5973647bfd..8d5f669466 100644 --- a/src/operators/softmax_op.cpp +++ b/src/operators/softmax_op.cpp @@ -27,7 +27,13 @@ template class SoftmaxOp; } // namespace paddle_mobile namespace ops = paddle_mobile::operators; -USE_OP(softmax); -REGISTER_OPERATOR(softmax, ops::SoftmaxOp); +#ifdef PADDLE_MOBILE_CPU +USE_OP_CPU(softmax); +REGISTER_OPERATOR_CPU(softmax, ops::SoftmaxOp); +#endif +#ifdef PADDLE_MOBILE_MALI_GPU +#endif +#ifdef PADDLE_MOBILE_FPGA +#endif #endif diff --git a/src/operators/transpose_op.cpp b/src/operators/transpose_op.cpp index 3abebc77ba..9ebe13aaa2 100644 --- a/src/operators/transpose_op.cpp +++ b/src/operators/transpose_op.cpp @@ -52,7 +52,14 @@ template class TransposeOp; } // namespace paddle_mobile namespace ops = paddle_mobile::operators; -USE_OP(transpose); -REGISTER_OPERATOR(transpose, ops::TransposeOp); +#ifdef PADDLE_MOBILE_CPU +USE_OP_CPU(transpose); +REGISTER_OPERATOR_CPU(transpose, ops::TransposeOp); +#endif +#ifdef PADDLE_MOBILE_MALI_GPU +#endif +#ifdef PADDLE_MOBILE_FPGA +#endif + #endif -- GitLab