Skip to content

Commit cc2f46c

Browse files
committed
Fix
1 parent 985e4ab commit cc2f46c

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

paddle/framework/executor.cc

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -97,24 +97,28 @@ void Executor::Run(const ProgramDescBind& pdesc, Scope* scope, int block_id,
9797
if (create_local_scope) {
9898
local_scope = &scope->NewScope();
9999
for (auto& var : block.AllVars()) {
100-
if (var->Persistable()) {
101-
auto* ptr = scope->Var(var->Name());
102-
CreateTensor(ptr, var->GetType());
103-
VLOG(3) << "Create Variable " << var->Name()
104-
<< " global, which pointer is " << ptr;
105-
} else {
106-
auto* ptr = local_scope->Var(var->Name());
107-
CreateTensor(ptr, var->GetType());
108-
VLOG(3) << "Create Variable " << var->Name()
109-
<< " locally, which pointer is " << ptr;
100+
if (var->Name() != kEmptyVarName) {
101+
if (var->Persistable()) {
102+
auto* ptr = scope->Var(var->Name());
103+
CreateTensor(ptr, var->GetType());
104+
VLOG(3) << "Create Variable " << var->Name()
105+
<< " global, which pointer is " << ptr;
106+
} else {
107+
auto* ptr = local_scope->Var(var->Name());
108+
CreateTensor(ptr, var->GetType());
109+
VLOG(3) << "Create Variable " << var->Name()
110+
<< " locally, which pointer is " << ptr;
111+
}
110112
}
111113
}
112114
} else {
113115
for (auto& var : block.AllVars()) {
114-
auto* ptr = local_scope->Var(var->Name());
115-
CreateTensor(ptr, var->GetType());
116-
VLOG(3) << "Create variable " << var->Name() << ", which pointer is "
117-
<< ptr;
116+
if (var->Name() != kEmptyVarName) {
117+
auto* ptr = local_scope->Var(var->Name());
118+
CreateTensor(ptr, var->GetType());
119+
VLOG(3) << "Create variable " << var->Name() << ", which pointer is "
120+
<< ptr;
121+
}
118122
}
119123
}
120124

0 commit comments

Comments
 (0)