From 727cc8dcab67ee0479d4b34f1486f4c257567eb3 Mon Sep 17 00:00:00 2001 From: zhangyang Date: Wed, 15 Aug 2018 12:24:38 +0800 Subject: [PATCH] change format --- src/operators/fusion_conv_bn_op.h | 17 ++++++++--------- src/operators/kernel/conv_bn_kernel.h | 3 +-- src/operators/kernel/fpga/conv_bn_kernel.cpp | 6 ++---- .../kernel/fpga/conv_bn_relu_kernel.cpp | 3 +-- 4 files changed, 12 insertions(+), 17 deletions(-) diff --git a/src/operators/fusion_conv_bn_op.h b/src/operators/fusion_conv_bn_op.h index 131e6b1681..620a22b19e 100644 --- a/src/operators/fusion_conv_bn_op.h +++ b/src/operators/fusion_conv_bn_op.h @@ -51,17 +51,16 @@ class FusionConvBNMatcher : public framework::FusionOpMatcher { template class FusionConvBNOp : public framework::OperatorWithKernel< - DeviceType, FusionConvBNParam, - operators::ConvBNKernel> { + DeviceType, FusionConvBNParam, + operators::ConvBNKernel> { public: FusionConvBNOp(const string &type, const VariableNameMap &inputs, - const VariableNameMap &outputs, - const framework::AttributeMap &attrs, - std::shared_ptr scope) - : framework::OperatorWithKernel< - DeviceType, FusionConvBNParam, - operators::ConvBNKernel>(type, inputs, outputs, - attrs, scope) {} + const VariableNameMap &outputs, + const framework::AttributeMap &attrs, + std::shared_ptr scope) + : framework::OperatorWithKernel>( + type, inputs, outputs, attrs, scope) {} void InferShape() const override; diff --git a/src/operators/kernel/conv_bn_kernel.h b/src/operators/kernel/conv_bn_kernel.h index e13f9b8c60..3bd9f87dcf 100644 --- a/src/operators/kernel/conv_bn_kernel.h +++ b/src/operators/kernel/conv_bn_kernel.h @@ -32,8 +32,7 @@ using framework::DDim; using framework::OpKernelBase; template -class ConvBNKernel - : public OpKernelBase { +class ConvBNKernel : public OpKernelBase { public: void Compute(const FusionConvBNParam ¶m) const; bool Init(FusionConvBNParam *param); diff --git a/src/operators/kernel/fpga/conv_bn_kernel.cpp b/src/operators/kernel/fpga/conv_bn_kernel.cpp index f9ca3ca1fd..fd95f47a1f 100644 --- a/src/operators/kernel/fpga/conv_bn_kernel.cpp +++ b/src/operators/kernel/fpga/conv_bn_kernel.cpp @@ -49,8 +49,7 @@ bool ConvBNKernel::Init(FusionConvBNParam *param) { for (int i = 0; i < channel; i++) { new_scale_ptr[i] = bn_scale_ptr[i] / static_cast(pow((bn_var_ptr[i] + epsilon), 0.5)); - new_bias_ptr[i] = - bn_bias_ptr[i] + (0 - bn_mean_ptr[i]) * new_scale_ptr[i]; + new_bias_ptr[i] = bn_bias_ptr[i] + (0 - bn_mean_ptr[i]) * new_scale_ptr[i]; bs_ptr[i * 2] = new_scale_ptr[i]; bs_ptr[i * 2 + 1] = new_bias_ptr[i]; } @@ -84,8 +83,7 @@ bool ConvBNKernel::Init(FusionConvBNParam *param) { } template <> -void ConvBNKernel::Compute( - const FusionConvBNParam ¶m) const { +void ConvBNKernel::Compute(const FusionConvBNParam ¶m) const { fpga::ComputeFpgaConv(param.FpgaArgs()); } template class ConvBNKernel; diff --git a/src/operators/kernel/fpga/conv_bn_relu_kernel.cpp b/src/operators/kernel/fpga/conv_bn_relu_kernel.cpp index 84b5c897b0..fbb3ca512e 100644 --- a/src/operators/kernel/fpga/conv_bn_relu_kernel.cpp +++ b/src/operators/kernel/fpga/conv_bn_relu_kernel.cpp @@ -46,8 +46,7 @@ bool ConvBNReluKernel::Init(FusionConvBNReluParam *param) { for (int i = 0; i < channel; i++) { new_scale_ptr[i] = bn_scale_ptr[i] / static_cast(pow((bn_var_ptr[i] + epsilon), 0.5)); - new_bias_ptr[i] = - bn_bias_ptr[i] + (0 - bn_mean_ptr[i]) * new_scale_ptr[i]; + new_bias_ptr[i] = bn_bias_ptr[i] + (0 - bn_mean_ptr[i]) * new_scale_ptr[i]; bs_ptr[i * 2] = new_scale_ptr[i]; bs_ptr[i * 2 + 1] = new_bias_ptr[i]; } -- GitLab