From d7588e2acd89953601a6253dff5b36005101451c Mon Sep 17 00:00:00 2001 From: liuruilong Date: Mon, 11 Jun 2018 19:16:51 +0800 Subject: [PATCH] format files --- src/framework/op_registry.h | 77 ++++++++++++----------- src/framework/operator.h | 1 - src/operators/batchnorm_op.cpp | 1 - src/operators/concat_op.cpp | 1 - src/operators/conv_op.cpp | 2 - src/operators/fusion_conv_add_relu_op.h | 2 +- src/operators/kernel/fpga/conv_kernel.cpp | 4 +- src/operators/transpose_op.cpp | 1 - 8 files changed, 42 insertions(+), 47 deletions(-) diff --git a/src/framework/op_registry.h b/src/framework/op_registry.h index 74a4b27250..f1f7a954e0 100644 --- a/src/framework/op_registry.h +++ b/src/framework/op_registry.h @@ -98,67 +98,68 @@ class OpRegistry { #ifdef PADDLE_MOBILE_CPU -#define REGISTER_OPERATOR_CPU(op_type, op_class) \ - template \ +#define REGISTER_OPERATOR_CPU(op_type, op_class) \ + template \ class _OpClass_##op_type##_cpu : public op_class { \ - public: \ + public: \ DEFINE_OP_CONSTRUCTOR(_OpClass_##op_type##_cpu, op_class); \ - }; \ - static paddle_mobile::framework::OperatorRegistrar< \ + }; \ + static paddle_mobile::framework::OperatorRegistrar< \ paddle_mobile::CPU, _OpClass_##op_type##_cpu> \ __op_registrar_##op_type##__cpu(#op_type); \ - int TouchOpRegistrar_##op_type##_cpu() { \ + int TouchOpRegistrar_##op_type##_cpu() { \ __op_registrar_##op_type##__cpu.Touch(); \ - return 0; \ + return 0; \ } -#define USE_OP_CPU(op_type) \ - extern int TouchOpRegistrar_##op_type##_cpu(); \ +#define USE_OP_CPU(op_type) \ + extern int TouchOpRegistrar_##op_type##_cpu(); \ static int use_op_itself_##op_type##_ __attribute__((unused)) = \ 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 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(); \ +#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 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(); \ +#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() diff --git a/src/framework/operator.h b/src/framework/operator.h index c49f850855..2ea7626711 100644 --- a/src/framework/operator.h +++ b/src/framework/operator.h @@ -137,7 +137,6 @@ class OpKernelBase { std::shared_ptr<::paddle_mobile::framework::Scope> scope) \ : parent_cls(type, inputs, outputs, attrs, scope) {} - class FusionOpMatcher { public: FusionOpMatcher() {} diff --git a/src/operators/batchnorm_op.cpp b/src/operators/batchnorm_op.cpp index 896e677e14..e36cb24b7c 100644 --- a/src/operators/batchnorm_op.cpp +++ b/src/operators/batchnorm_op.cpp @@ -40,5 +40,4 @@ REGISTER_OPERATOR_CPU(batch_norm, ops::BatchNormOp); #ifdef PADDLE_MOBILE_FPGA #endif - #endif diff --git a/src/operators/concat_op.cpp b/src/operators/concat_op.cpp index a128629e77..b9eacde60e 100644 --- a/src/operators/concat_op.cpp +++ b/src/operators/concat_op.cpp @@ -61,7 +61,6 @@ template class ConcatOp; } // namespace operators } // namespace paddle_mobile - namespace ops = paddle_mobile::operators; #ifdef PADDLE_MOBILE_CPU USE_OP_CPU(concat); diff --git a/src/operators/conv_op.cpp b/src/operators/conv_op.cpp index 7b06a29fe9..4be442f616 100644 --- a/src/operators/conv_op.cpp +++ b/src/operators/conv_op.cpp @@ -66,6 +66,4 @@ USE_OP_FPGA(conv2d); REGISTER_OPERATOR_FPGA(conv2d, ops::ConvOp); #endif - - #endif diff --git a/src/operators/fusion_conv_add_relu_op.h b/src/operators/fusion_conv_add_relu_op.h index 601486f209..eb8dd205b4 100644 --- a/src/operators/fusion_conv_add_relu_op.h +++ b/src/operators/fusion_conv_add_relu_op.h @@ -47,7 +47,7 @@ class ConvAddReluOp { }; #ifdef PADDLE_MOBILE_CPU -//static framework::FusionOpRegistrar fusion_conv_add_relu_registrar( +// static framework::FusionOpRegistrar fusion_conv_add_relu_registrar( // new FushionConvAddReluOpMatcher()); #endif #ifdef PADDLE_MOBILE_MALI_GPU diff --git a/src/operators/kernel/fpga/conv_kernel.cpp b/src/operators/kernel/fpga/conv_kernel.cpp index 00a7e4a3d6..d2c08992a8 100644 --- a/src/operators/kernel/fpga/conv_kernel.cpp +++ b/src/operators/kernel/fpga/conv_kernel.cpp @@ -19,11 +19,11 @@ limitations under the License. */ namespace paddle_mobile { namespace operators { -template<> +template <> void ConvKernel::Compute(const ConvParam ¶m) const {} template class ConvKernel; -} +} // namespace operators } // namespace paddle_mobile #endif diff --git a/src/operators/transpose_op.cpp b/src/operators/transpose_op.cpp index 9ebe13aaa2..02a3b16e8d 100644 --- a/src/operators/transpose_op.cpp +++ b/src/operators/transpose_op.cpp @@ -61,5 +61,4 @@ REGISTER_OPERATOR_CPU(transpose, ops::TransposeOp); #ifdef PADDLE_MOBILE_FPGA #endif - #endif -- GitLab