From 114d90eeebe0e64c9a866784c958f3d6af2e7bc5 Mon Sep 17 00:00:00 2001 From: zhaojiaying01 Date: Fri, 10 Aug 2018 14:13:15 +0800 Subject: [PATCH] adjust code style --- .../kernel/central-arm-func/conv_add_relu_arm_func.h | 5 ----- src/operators/kernel/central-arm-func/conv_arm_func.h | 3 +-- src/operators/kernel/central-arm-func/fusion_fc_arm_func.h | 6 +++--- src/operators/kernel/central-arm-func/mul_arm_func.h | 3 +-- src/operators/math/gemm.cpp | 2 +- 5 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/operators/kernel/central-arm-func/conv_add_relu_arm_func.h b/src/operators/kernel/central-arm-func/conv_add_relu_arm_func.h index 7b019b60db..6c619dd2a2 100644 --- a/src/operators/kernel/central-arm-func/conv_add_relu_arm_func.h +++ b/src/operators/kernel/central-arm-func/conv_add_relu_arm_func.h @@ -32,12 +32,7 @@ void ConvAddReluCompute(const FusionConvAddReluParam ¶m) { Tensor bias = *param.Bias(); int axis = param.Axis(); Tensor *output = param.Output(); - // math::expand_bias(bias, axis, output->dims()); - float *output_data = output->data(); float *biase_data = bias.data(); - // for (int k = 0; k < output->numel(); ++k) { - // output_data[k] = biase_data[k]; - // } int groups = param.Groups(); std::vector strides = param.Strides(); diff --git a/src/operators/kernel/central-arm-func/conv_arm_func.h b/src/operators/kernel/central-arm-func/conv_arm_func.h index 41acb97340..33caded3af 100644 --- a/src/operators/kernel/central-arm-func/conv_arm_func.h +++ b/src/operators/kernel/central-arm-func/conv_arm_func.h @@ -30,7 +30,6 @@ inline void ConvBasic(const ConvParam ¶m) { Tensor filter = *param.Filter(); Tensor *output = param.Output(); output->mutable_data(); - float *bias_data = output->mutable_data(); int groups = param.Groups(); std::vector strides = param.Strides(); std::vector paddings = param.Paddings(); @@ -107,7 +106,7 @@ inline void ConvBasic(const ConvParam ¶m) { Tensor filter_slice = filter.Slice(g * out_step, (g + 1) * out_step); math::matmul(filter_slice, false, col_matrix, false, static_cast(1), &out_slice, - static_cast(0), false, bias_data); + static_cast(0)); } } } diff --git a/src/operators/kernel/central-arm-func/fusion_fc_arm_func.h b/src/operators/kernel/central-arm-func/fusion_fc_arm_func.h index 4a689dfc18..78a9b6b026 100644 --- a/src/operators/kernel/central-arm-func/fusion_fc_arm_func.h +++ b/src/operators/kernel/central-arm-func/fusion_fc_arm_func.h @@ -55,9 +55,9 @@ void FusionFcCompute(const FusionFcParam ¶m) { memory::Copy(out_data + i * classes, input_z_data, sizeof(float) * classes); } - // for (int i = 0; i < out->numel(); i++) { - // DLOG << out_data[i]; - // } + for (int i = 0; i < out->numel(); i++) { + DLOG << out_data[i]; + } math::matmul(x_matrix, false, y_matrix, false, static_cast(1), out, static_cast(1), false, bias_data); PADDLE_MOBILE_ENFORCE(out_dim.size() == 2, " out_dim.size must be 2."); diff --git a/src/operators/kernel/central-arm-func/mul_arm_func.h b/src/operators/kernel/central-arm-func/mul_arm_func.h index 341759a96e..d2da67afe1 100644 --- a/src/operators/kernel/central-arm-func/mul_arm_func.h +++ b/src/operators/kernel/central-arm-func/mul_arm_func.h @@ -59,7 +59,6 @@ void MulCompute(const MulParam ¶m) { const Tensor *input_y = param.InputY(); Tensor *out = param.Out(); out->mutable_data(); - float *bias_data = out->mutable_data(); const Tensor x_matrix = input_x->dims().size() > 2 ? framework::ReshapeToMatrix(*input_x, param.XNumColDims()) @@ -73,7 +72,7 @@ void MulCompute(const MulParam ¶m) { out->Resize({x_matrix.dims()[0], y_matrix.dims()[1]}); } math::matmul(x_matrix, false, y_matrix, false, static_cast(1), - out, static_cast(0), false, bias_data); + out, static_cast(0)); if (out_dim.size() != 2) { out->Resize(out_dim); } diff --git a/src/operators/math/gemm.cpp b/src/operators/math/gemm.cpp index ef1625b72c..2b7363b0ef 100644 --- a/src/operators/math/gemm.cpp +++ b/src/operators/math/gemm.cpp @@ -373,9 +373,9 @@ void InnerKernel(int mc, int nc, float alpha, const float *a, const float *b, #endif } } + if (alpha != 1) { WriteWithAlphaBeta(mc, nc, c, C, ldc); - return; } if (beta == 0) { -- GitLab