From ddd8e462cbbe6a11ba98de01144c97c137d7f16a Mon Sep 17 00:00:00 2001 From: liuruilong Date: Thu, 31 May 2018 16:25:58 +0800 Subject: [PATCH] format files --- src/common/types.h | 3 ++- src/framework/program/program-optimize/node.cpp | 6 +++--- src/framework/program/program-optimize/node.h | 8 ++++---- .../program/program-optimize/program_optimize.cpp | 10 ++++------ .../program/program-optimize/program_optimize.h | 5 ++--- src/io.cpp | 1 - src/operators/fusion_conv_add_relu_op.h | 2 +- src/operators/fusion_fc_op.h | 4 ++-- 8 files changed, 18 insertions(+), 21 deletions(-) diff --git a/src/common/types.h b/src/common/types.h index 5e651a8951..04b78947a6 100644 --- a/src/common/types.h +++ b/src/common/types.h @@ -77,7 +77,8 @@ static const std::string G_OP_TYPE_BATCHNORM = "batch_norm"; static const std::string G_OP_TYPE_BOX_CODER = "box_coder"; static const std::string G_OP_TYPE_CONCAT = "concat"; static const std::string G_OP_TYPE_ELEMENTWISE_ADD = "elementwise_add"; -static const std::string G_OP_TYPE_FUSION_CONV_ADD_RELU = "fusion_conv_add_relu"; +static const std::string G_OP_TYPE_FUSION_CONV_ADD_RELU = + "fusion_conv_add_relu"; static const std::string G_OP_TYPE_FC = "fc"; static const std::string G_OP_TYPE_LRN = "lrn"; static const std::string G_OP_TYPE_MUL = "mul"; diff --git a/src/framework/program/program-optimize/node.cpp b/src/framework/program/program-optimize/node.cpp index 3910dc7a0b..c165b6568a 100644 --- a/src/framework/program/program-optimize/node.cpp +++ b/src/framework/program/program-optimize/node.cpp @@ -51,9 +51,9 @@ bool Node::CanSplit(std::unordered_set complex_compute_set) { return split; } -void Node::CanSplit(bool *split, bool spliting, - int complex_count, - std::unordered_set *complex_compute_set, Node *pre_node) { +void Node::CanSplit(bool *split, bool spliting, int complex_count, + std::unordered_set *complex_compute_set, + Node *pre_node) { if (spliting) { if (complex_compute_set->find(this->type_) != complex_compute_set->end()) { complex_count++; diff --git a/src/framework/program/program-optimize/node.h b/src/framework/program/program-optimize/node.h index 914cb19589..8ef26f897d 100644 --- a/src/framework/program/program-optimize/node.h +++ b/src/framework/program/program-optimize/node.h @@ -16,9 +16,9 @@ limitations under the License. */ #include #include +#include #include #include -#include #include "common/log.h" #include "framework/paddle_mobile_object.h" @@ -51,9 +51,9 @@ class Node : PaddleMobileObject { void Description(); private: - void CanSplit(bool *split, bool spliting, - int complex_count, - std::unordered_set *complex_compute_set, Node *pre_node); + void CanSplit(bool *split, bool spliting, int complex_count, + std::unordered_set *complex_compute_set, + Node *pre_node); void OpDescs(std::vector> *op_desc, Node *node, bool adding_thread, int thread_num); void OpDescs(uint size, diff --git a/src/framework/program/program-optimize/program_optimize.cpp b/src/framework/program/program-optimize/program_optimize.cpp index 11f9b17ad5..d9c3c51c3c 100644 --- a/src/framework/program/program-optimize/program_optimize.cpp +++ b/src/framework/program/program-optimize/program_optimize.cpp @@ -99,7 +99,8 @@ std::shared_ptr ProgramOptimize::FushionOptimize( // DLOG << "node: \n" << *begin_node; std::vector> op_descs; - // bool can_splite = begin_node->CanSplit({G_OP_TYPE_CONV, G_OP_TYPE_BATCHNORM, G_OP_TYPE_DEPTHWISE_CONV}); + // bool can_splite = begin_node->CanSplit({G_OP_TYPE_CONV, + // G_OP_TYPE_BATCHNORM, G_OP_TYPE_DEPTHWISE_CONV}); GenerateOps(&op_descs, begin_node.get()); block->ops_ = op_descs; } @@ -112,11 +113,9 @@ std::shared_ptr ProgramOptimize::FushionOptimize( return optimize_program; } - void ProgramOptimize::GenerateOps( - std::vector> *op_desc, Node *input_node, - Node *current_node) { - + std::vector> *op_desc, Node *input_node, + Node *current_node) { if (current_node->inputs_.size() > 1 && input_node != current_node->inputs_.back()) { return; @@ -131,7 +130,6 @@ void ProgramOptimize::GenerateOps( auto &output = current_node->outputs_[i]; GenerateOps(op_desc, current_node, output.get()); } - } void ProgramOptimize::GenerateOps( diff --git a/src/framework/program/program-optimize/program_optimize.h b/src/framework/program/program-optimize/program_optimize.h index 701358f590..93943cf839 100644 --- a/src/framework/program/program-optimize/program_optimize.h +++ b/src/framework/program/program-optimize/program_optimize.h @@ -35,9 +35,8 @@ class ProgramOptimize { std::vector> new_blocks_; void GenerateOps(std::vector> *op_descs, Node *begin_node); - void GenerateOps( - std::vector> *op_desc, Node *input_node, - Node *current_node); + void GenerateOps(std::vector> *op_desc, + Node *input_node, Node *current_node); void GenerateOps(std::vector> *op_desc, Node *input_node, Node *current_node, bool adding_thread, int thread_num, std::shared_ptr new_block); diff --git a/src/io.cpp b/src/io.cpp index c99556f086..8f6a07f2dd 100644 --- a/src/io.cpp +++ b/src/io.cpp @@ -232,7 +232,6 @@ const framework::Program Loader::Load( originProgramDesc->Description("program: "); } - paddle_mobile__framework__proto__program_desc__free_unpacked(c_program, NULL); return program; } diff --git a/src/operators/fusion_conv_add_relu_op.h b/src/operators/fusion_conv_add_relu_op.h index 0f52562f0b..e93c910d2b 100644 --- a/src/operators/fusion_conv_add_relu_op.h +++ b/src/operators/fusion_conv_add_relu_op.h @@ -32,7 +32,7 @@ class FushionConvAddReluOpMatcher : public framework::FusionOpMatcher { std::vector> origin_descs = node->OpDescs(node_.Depth()); node->Folder(node_.Depth(), Type(), - {{G_OP_TYPE_ELEMENTWISE_ADD, {"Y", "Z"}}}); + {{G_OP_TYPE_ELEMENTWISE_ADD, {"Y", "Z"}}}); } std::string Type() { return G_OP_TYPE_FUSION_CONV_ADD_RELU; } }; diff --git a/src/operators/fusion_fc_op.h b/src/operators/fusion_fc_op.h index fe62863144..9019ef4d49 100644 --- a/src/operators/fusion_fc_op.h +++ b/src/operators/fusion_fc_op.h @@ -32,11 +32,11 @@ class FusionFcMatcher : public framework::FusionOpMatcher { node_ > std::make_shared(G_OP_TYPE_ELEMENTWISE_ADD); } - void FolderNodes(framework::Node *node) { + void FolderNodes(framework::Node *node) { vector> origin_descs = node->OpDescs(node_.Depth()); node->Folder(node_.Depth(), Type(), - {{G_OP_TYPE_ELEMENTWISE_ADD, {"Y", "Z"}}}); + {{G_OP_TYPE_ELEMENTWISE_ADD, {"Y", "Z"}}}); } std::string Type() { return G_OP_TYPE_FC; } -- GitLab