diff --git a/paddle/fluid/operators/save_op.cc b/paddle/fluid/operators/save_op.cc index d43216749cd3326b95ac97612c420131ed0a922c..941bca1047760a802f72f78d709035787e58cd01 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); -