提交 ee4f8ba1 编写于 作者: L liuruilong

format files

上级 388d5393
...@@ -13,23 +13,23 @@ See the License for the specific language governing permissions and ...@@ -13,23 +13,23 @@ See the License for the specific language governing permissions and
limitations under the License. */ limitations under the License. */
#include "io.h" #include "io.h"
#include <vector>
#include <fstream> #include <fstream>
#include <vector>
#include "common/log.h"
#include "common/enforce.h" #include "common/enforce.h"
#include "framework/scope.h" #include "common/log.h"
#include "framework/tensor.h"
#include "framework/lod_tensor.h"
#include "framework/framework.pb.h" #include "framework/framework.pb.h"
#include "framework/lod_tensor.h"
#include "framework/program/program_desc.h" #include "framework/program/program_desc.h"
#include "framework/scope.h"
#include "framework/tensor.h"
namespace paddle_mobile { namespace paddle_mobile {
void ReadBinaryFile(const std::string &filename, std::string *contents) { void ReadBinaryFile(const std::string &filename, std::string *contents) {
std::ifstream fin(filename, std::ios::in | std::ios::binary); std::ifstream fin(filename, std::ios::in | std::ios::binary);
PADDLE_MOBILE_ENFORCE(fin.is_open(), PADDLE_MOBILE_ENFORCE(fin.is_open(), "open file: %s failed",
"open file: %s failed", filename.c_str()); filename.c_str());
fin.seekg(0, std::ios::end); fin.seekg(0, std::ios::end);
contents->clear(); contents->clear();
contents->resize(fin.tellg()); contents->resize(fin.tellg());
...@@ -42,8 +42,8 @@ template <typename Dtype, Precision P> ...@@ -42,8 +42,8 @@ template <typename Dtype, Precision P>
void Loader<Dtype, P>::LoadVar(framework::LoDTensor *tensor, void Loader<Dtype, P>::LoadVar(framework::LoDTensor *tensor,
const std::string &file_path) { const std::string &file_path) {
std::ifstream is(file_path); std::ifstream is(file_path);
PADDLE_MOBILE_ENFORCE(is.is_open(), PADDLE_MOBILE_ENFORCE(is.is_open(), "open file: %s failed",
"open file: %s failed", file_path.c_str()); file_path.c_str());
std::fpos<mbstate_t> pos; std::fpos<mbstate_t> pos;
pos = is.tellg(); // save current position pos = is.tellg(); // save current position
is.seekg(0, std::ios::end); is.seekg(0, std::ios::end);
...@@ -243,8 +243,8 @@ const framework::Program<Dtype, P> Loader<Dtype, P>::Load( ...@@ -243,8 +243,8 @@ const framework::Program<Dtype, P> Loader<Dtype, P>::Load(
var.type().type() != framework::proto::VarType::FETCH_LIST) { var.type().type() != framework::proto::VarType::FETCH_LIST) {
std::string file_path = dirname + "/" + var.name(); std::string file_path = dirname + "/" + var.name();
std::ifstream is(file_path); std::ifstream is(file_path);
PADDLE_MOBILE_ENFORCE(is.is_open(), PADDLE_MOBILE_ENFORCE(is.is_open(), "open file: %s failed",
"open file: %s failed", file_path.c_str()); file_path.c_str());
std::fpos<mbstate_t> pos; std::fpos<mbstate_t> pos;
pos = is.tellg(); // save current position pos = is.tellg(); // save current position
is.seekg(0, std::ios::end); is.seekg(0, std::ios::end);
......
...@@ -18,8 +18,8 @@ limitations under the License. */ ...@@ -18,8 +18,8 @@ limitations under the License. */
#include "common/types.h" #include "common/types.h"
#include "framework/lod_tensor.h" #include "framework/lod_tensor.h"
#include "framework/program/program.h"
#include "framework/paddle_mobile_object.h" #include "framework/paddle_mobile_object.h"
#include "framework/program/program.h"
namespace paddle_mobile { namespace paddle_mobile {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册