From 91eae9cc916f23e7e67bf7d84d8be1025aa73ed9 Mon Sep 17 00:00:00 2001 From: tangwei12 Date: Wed, 20 Jun 2018 11:59:40 +0800 Subject: [PATCH] code style --- paddle/fluid/operators/save_op.cc | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/paddle/fluid/operators/save_op.cc b/paddle/fluid/operators/save_op.cc index d43216749c..941bca1047 100644 --- a/paddle/fluid/operators/save_op.cc +++ b/paddle/fluid/operators/save_op.cc @@ -69,7 +69,6 @@ class SaveOp : public framework::OperatorBase { private: void RunImpl(const framework::Scope &scope, const platform::Place &place) const override { - auto iname = Input("X"); auto *var = scope.FindVar(iname); PADDLE_ENFORCE(var != nullptr, "Cannot find variable %s for save_op", @@ -87,7 +86,7 @@ class SaveOp : public framework::OperatorBase { } } - void SaveLodTensor( const platform::Place &place, + void SaveLodTensor(const platform::Place &place, framework::Variable *var) const { auto filename = Attr("file_path"); auto overwrite = Attr("overwrite"); @@ -132,8 +131,11 @@ class SaveOp : public framework::OperatorBase { void SaveSelectedRows(const framework::Scope &scope, const platform::Place &place, framework::Variable *var) const { - auto *lt_var = scope.FindVar("loopup_table_path")->GetMutable(); - PADDLE_ENFORCE(lt_var != nullptr, "Cannot find variable loopup_table_path for SaveSelectedRows"); + auto *lt_var = + scope.FindVar("loopup_table_path")->GetMutable(); + PADDLE_ENFORCE( + lt_var != nullptr, + "Can not find variable loopup_table_path for SaveSelectedRows"); std::string filename = lt_var->data(); VLOG(4) << "SaveSelectedRows get File name: " << filename; @@ -195,17 +197,11 @@ class SaveOpShapeInference : public framework::InferShapeBase { public: void operator()(framework::InferShapeContext *ctx) const override {} }; -} -} - -// namespace operators -// namespace paddle +} // namespace operators +} // namespace paddle namespace ops = paddle::operators; -REGISTER_OPERATOR(save, ops::SaveOp, - paddle::framework::EmptyGradOpMaker, - ops::SaveOpProtoMaker, - ops::SaveOpVarTypeInference, +REGISTER_OPERATOR(save, ops::SaveOp, paddle::framework::EmptyGradOpMaker, + ops::SaveOpProtoMaker, ops::SaveOpVarTypeInference, ops::SaveOpShapeInference); - -- GitLab