From bd59518f5966102a8268349d12daa99047d24b94 Mon Sep 17 00:00:00 2001 From: liuruilong Date: Tue, 5 Jun 2018 14:18:49 +0800 Subject: [PATCH] format files --- src/common/protobuf-c.h | 1 - src/framework/data_transform.h | 2 +- .../program-optimize/fusion_op_register.h | 2 +- src/io.cpp | 23 ++++++++----------- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/common/protobuf-c.h b/src/common/protobuf-c.h index db86d88b86..bd85695b86 100644 --- a/src/common/protobuf-c.h +++ b/src/common/protobuf-c.h @@ -877,7 +877,6 @@ PROTOBUF_C__API void protobuf_c_message_init(const ProtobufCMessageDescriptor *descriptor, void *message); - /** * Initialise a `ProtobufCBufferSimple` object. */ diff --git a/src/framework/data_transform.h b/src/framework/data_transform.h index e380eacf0e..dee78b296c 100644 --- a/src/framework/data_transform.h +++ b/src/framework/data_transform.h @@ -18,9 +18,9 @@ limitations under the License. */ #include #include +#include "framework/op_kernel_type.h" #include "framework/tensor.h" #include "framework/variable.h" -#include "framework/op_kernel_type.h" namespace paddle_mobile { namespace framework { diff --git a/src/framework/program/program-optimize/fusion_op_register.h b/src/framework/program/program-optimize/fusion_op_register.h index ff50dcafbc..4cc83f8c80 100644 --- a/src/framework/program/program-optimize/fusion_op_register.h +++ b/src/framework/program/program-optimize/fusion_op_register.h @@ -17,8 +17,8 @@ limitations under the License. */ #include #include -#include "node.h" #include "framework/operator.h" +#include "node.h" namespace paddle_mobile { namespace framework { diff --git a/src/io.cpp b/src/io.cpp index 082339c67e..5c7f34f6cc 100644 --- a/src/io.cpp +++ b/src/io.cpp @@ -17,28 +17,30 @@ limitations under the License. */ #include "common/log.h" #include "common/enforce.h" -#include "framework/scope.h" -#include "framework/tensor.h" -#include "framework/operator.h" -#include "framework/lod_tensor.h" #include "framework/framework.pb-c.h" -#include "framework/program/var_desc.h" -#include "framework/program/program_desc.h" +#include "framework/lod_tensor.h" +#include "framework/operator.h" #include "framework/program/program-optimize/program_optimize.h" +#include "framework/program/program_desc.h" +#include "framework/program/var_desc.h" +#include "framework/scope.h" +#include "framework/tensor.h" namespace paddle_mobile { using framework::Variable; char *Get_binary_data(std::string filename) { FILE *file = fopen(filename.c_str(), "rb"); - PADDLE_MOBILE_ENFORCE(file != nullptr, "can't open file: %s ", filename.c_str()); + PADDLE_MOBILE_ENFORCE(file != nullptr, "can't open file: %s ", + filename.c_str()); fseek(file, 0, SEEK_END); long size = ftell(file); PADDLE_MOBILE_ENFORCE(size > 0, "size is too small"); rewind(file); char *data = new char[size]; size_t bytes_read = fread(data, 1, size, file); - PADDLE_MOBILE_ENFORCE(bytes_read == size, "read binary file bytes do not match with fseek"); + PADDLE_MOBILE_ENFORCE(bytes_read == size, + "read binary file bytes do not match with fseek"); fclose(file); return data; } @@ -84,7 +86,6 @@ void Loader::LoadVar(framework::Variable *variable, auto &lod = *tensor->mutable_lod(); lod.resize(lod_level); for (uint64_t i = 0; i < lod_level; ++i) { - uint32_t size = *(uint64_t *)data; data += sizeof(uint64_t); @@ -100,7 +101,6 @@ void Loader::LoadVar(framework::Variable *variable, uint32_t tensor_version = *(uint32_t *)data; data += sizeof(uint32_t); - // 4. tensor desc uint32_t size = *(int32_t *)data; data += sizeof(int32_t); @@ -278,16 +278,13 @@ void Executor::LoadMemory(const framework::VarDesc var_desc, data += sizeof(uint64_t); DLOG << "lod_level: " << lod_level; - auto &lod = *tensor->mutable_lod(); lod.resize(lod_level); for (uint64_t i = 0; i < lod_level; ++i) { - uint64_t size = *(uint64_t *)data; data += sizeof(uint64_t); DLOG << "lod size: " << i << size; - std::vector tmp(size / sizeof(size_t)); for (int k = 0; k < tmp.size(); ++k) { -- GitLab