diff --git a/paddle/fluid/framework/new_executor/data_transfer.cc b/paddle/fluid/framework/new_executor/data_transfer.cc index 15e6b2a1ff9391bf9c4e318a726e5c664a2ac9d2..064dfa0170bdb7f7414fa712a236458ca5f99f5b 100644 --- a/paddle/fluid/framework/new_executor/data_transfer.cc +++ b/paddle/fluid/framework/new_executor/data_transfer.cc @@ -137,7 +137,7 @@ std::shared_ptr TransferLayout(const std::string& var_name, // 1. Generate new_var_name and Initialize it *new_var_name = var_name + "_layout_" + std::to_string(var_scope->VarSize() + 1); - auto* ptr = local_scope->Var(new_var_name); + auto* ptr = local_scope->Var(*new_var_name); auto var_type = var_scope->Var(var_name)->Type(); InitializeVariable(ptr, static_cast(var_type)); @@ -171,8 +171,8 @@ std::shared_ptr TransferDtype(const std::string& var_name, // 1. Generate new_var_name and Initialize it *new_var_name = var_name + "_dtype_" + std::to_string(var_scope->VarSize() + 1); - auto* ptr = local_scope->Var(new_var_name); - var_scope->SetVarDesc(var_name, nullptr); + auto* ptr = local_scope->Var(*new_var_name); + auto var_type = var_scope->Var(var_name)->Type(); InitializeVariable(ptr, static_cast(var_type)); @@ -211,7 +211,7 @@ std::shared_ptr TransferDevice(const std::string& var_name, // 1. Generate new_var_name and Initialize it *new_var_name = var_name + "_device_" + std::to_string(var_scope->VarSize() + 1); - auto* ptr = local_scope->Var(new_var_name); + auto* ptr = local_scope->Var(*new_var_name); auto var_type = var_scope->Var(var_name)->Type(); InitializeVariable(ptr, static_cast(var_type));