提交 f9d4b9da 编写于 作者: T tangwei12

fix auto serial_num has no initializer

上级 7b6c0abf
......@@ -112,14 +112,14 @@ class CheckpointLoadOp : public framework::OperatorBase {
std::string serial_var_name = std::string(SERIAL_VAR);
auto *serial_var = scope.FindVar(serial_var_name);
auto *serial_num;
if (serial_var == nullptr) {
*serial_var = scope.Var(serial_var_name);
*serial_num = serial_var->GetMutable<std::string>();
serial_num->append("0");
auto *serial_tmp = serial_var->GetMutable<std::string>();
serial_tmp->append("0");
}
*serial_num = serial_var->GetMutable<std::string>();
auto *serial_num = serial_var->GetMutable<std::string>();
VLOG(1) << "CheckpointLoadOp set " << SERIAL_NUMBER
<< " value: " << serial_num;
......
......@@ -84,14 +84,13 @@ class CheckpointSaveOp : public framework::OperatorBase {
std::string serial_var_name = std::string(SERIAL_VAR);
auto *serial_var = scope.FindVar(serial_var_name);
auto *serial_num;
if (serial_var == nullptr) {
*serial_var = scope.Var(serial_var_name);
*serial_num = serial_var->GetMutable<std::string>();
serial_num->append("0");
*serial_tmp = serial_var->GetMutable<std::string>();
serial_tmp->append("0");
}
*serial_num = serial_var->GetMutable<std::string>();
auto *serial_num = serial_var->GetMutable<std::string>();
VLOG(1) << "CheckpointSaveOp get " << SERIAL_NUMBER
<< " value: " << serial_num;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册