提交 091b2661 编写于 作者: L liuruilong

fix feed input crash

上级 c2062894
...@@ -908,10 +908,14 @@ void Executor<GPU_CL, Precision::FP32>::InitMemory() { ...@@ -908,10 +908,14 @@ void Executor<GPU_CL, Precision::FP32>::InitMemory() {
for (const auto &var_desc : block->Vars()) { for (const auto &var_desc : block->Vars()) {
auto var = program_.scope->Var(var_desc->Name()); auto var = program_.scope->Var(var_desc->Name());
if (var_desc->Persistable()) { if (var_desc->Persistable()) {
auto cl_image = var->template GetMutable<framework::CLImage>(); CLImage *cl_image = nullptr;
if (var_desc->Name() == "feed" || var_desc->Name() == "fetch") { if (var_desc->Name() == "feed" || var_desc->Name() == "fetch") {
var->template GetMutable<framework::LoDTensor>();
continue; continue;
} else {
cl_image = var->template GetMutable<framework::CLImage>();
} }
char *origin_data = char *origin_data =
Get_binary_data(program_.model_path + "/" + var_desc->Name()); Get_binary_data(program_.model_path + "/" + var_desc->Name());
char *data = origin_data; char *data = origin_data;
...@@ -966,9 +970,12 @@ void Executor<GPU_CL, Precision::FP32>::InitCombineMemory() { ...@@ -966,9 +970,12 @@ void Executor<GPU_CL, Precision::FP32>::InitCombineMemory() {
for (const auto &var_desc : block->Vars()) { for (const auto &var_desc : block->Vars()) {
auto var = program_.scope->Var(var_desc->Name()); auto var = program_.scope->Var(var_desc->Name());
if (var_desc->Persistable()) { if (var_desc->Persistable()) {
auto cl_image = var->template GetMutable<framework::CLImage>(); CLImage *cl_image = nullptr;
if (var_desc->Name() == "feed" || var_desc->Name() == "fetch") { if (var_desc->Name() == "feed" || var_desc->Name() == "fetch") {
var->template GetMutable<framework::LoDTensor>();
continue; continue;
} else {
cl_image = var->template GetMutable<framework::CLImage>();
} }
cl_context context = program_.scope->GetCLScpoe()->Context(); cl_context context = program_.scope->GetCLScpoe()->Context();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册