diff --git a/src/framework/executor.cpp b/src/framework/executor.cpp index fc1030b63994cefb3c383d532ce4b2e6d0605dd6..9c898ba554725aa36f9bab034c8d9dcf936f1bae 100644 --- a/src/framework/executor.cpp +++ b/src/framework/executor.cpp @@ -818,9 +818,21 @@ void Executor::InitMemory() { cl_context context = program_.scope->GetCLScpoe()->Context(); float *tensorInput = (float *)origin_data; + + const framework::TensorDesc &desc = var_desc->Tensor_desc(); framework::DDim ddim = cl_image->dims(); + cl_image->Init(context, tensorInput, ddim); delete origin_data; + }else{ + auto cl_image = var->template GetMutable(); + cl_context context = program_.scope->GetCLScpoe()->Context(); + + const framework::TensorDesc &desc = var_desc->Tensor_desc(); + framework::DDim ddim = cl_image->dims(); + + cl_image->Init(context, ddim); + } } } @@ -850,6 +862,7 @@ void Executor::InitCombineMemory() { cl_context context = program_.scope->GetCLScpoe()->Context(); + const framework::TensorDesc &desc = var_desc->Tensor_desc(); framework::DDim ddim = cl_image->dims(); int numel = 1; @@ -857,8 +870,16 @@ void Executor::InitCombineMemory() { numel = numel * ddim[i]; } float *tensorInput = data; - data += numel; cl_image->Init(context, tensorInput, ddim); + data += numel; + }else{ + auto cl_image = var->template GetMutable(); + cl_context context = program_.scope->GetCLScpoe()->Context(); + + const framework::TensorDesc &desc = var_desc->Tensor_desc(); + framework::DDim ddim = cl_image->dims(); + + cl_image->Init(context, ddim); } } }