diff --git a/src/framework/cl/cl_helper.h b/src/framework/cl/cl_helper.h index 7890ad0656cf792ef42ae1c11d761f9f038a05f6..7562ab78695376d9766a72eefc2d5482283c49b7 100644 --- a/src/framework/cl/cl_helper.h +++ b/src/framework/cl/cl_helper.h @@ -47,9 +47,6 @@ class CLHelper { return scope_->Context(); } - - - private: CLScope *scope_; std::vector> kernels; diff --git a/src/framework/cl/cl_image.h b/src/framework/cl/cl_image.h index 0b842fb56fa4860c759cb6438b85a07df832f66f..5bcd09984f1985e0465087e610bd528c4a689032 100644 --- a/src/framework/cl/cl_image.h +++ b/src/framework/cl/cl_image.h @@ -32,7 +32,9 @@ class CLImage { } - const DDim &TensorDim(); + const DDim &TensorDim() { + return tensorDims_; + } std::vector DefaultWorkSize() { return {}; @@ -45,13 +47,13 @@ class CLImage { cl_context context_; }; -void TensorToCLImage(Tensor *tensor, CLImage *image) { - -} - -void CLImageToTensor(CLImage *image, Tensor *tensor) { - -} +//void TensorToCLImage(Tensor *tensor, CLImage *image) { +// +//} +// +//void CLImageToTensor(CLImage *image, Tensor *tensor) { +// +//} } } \ No newline at end of file diff --git a/src/io/executor.cpp b/src/io/executor.cpp index f94ae37e5124785760fda4d49a4ac760e6d86484..9803a35edeb444ac74ffd8feac2b9d57cb80b479 100644 --- a/src/io/executor.cpp +++ b/src/io/executor.cpp @@ -16,6 +16,7 @@ limitations under the License. */ #include #include #include +#include #include "common/enforce.h" #include "common/log.h" #include "framework/framework.pb-c.h" @@ -233,6 +234,7 @@ void Executor::InitMemory() { Get_binary_data(program_.model_path + "/" + var_desc->Name()); char *data = origin_data; LoadMemory(*var_desc, tensor, &data); + delete origin_data; } else { if (var_desc->Type() == framework::VARTYPE_TYPE_LOD_TENSOR) { diff --git a/src/operators/kernel/cl/conv_kernel.cpp b/src/operators/kernel/cl/conv_kernel.cpp index bc8949b6b64fdb5da2fa4fb2c69dbdb75251087c..451f96447e458524e698f5068bba73f763b236b2 100644 --- a/src/operators/kernel/cl/conv_kernel.cpp +++ b/src/operators/kernel/cl/conv_kernel.cpp @@ -31,7 +31,6 @@ void ConvKernel::Compute(const ConvParam ¶m) { auto kernel = this->cl_helper_.KernelAt(0); size_t global_work_size[3] = {1, 2, 3}; clEnqueueNDRangeKernel(this->cl_helper_.CLCommandQueue(), kernel, 3, NULL, global_work_size, NULL, 0, NULL, NULL); - } template class ConvKernel; diff --git a/src/operators/op_param.h b/src/operators/op_param.h index 5b53743b75bfe65a9e029e44114b339603388c08..ec5904a8225f4f64c5d55a93888052f0f500f629 100644 --- a/src/operators/op_param.h +++ b/src/operators/op_param.h @@ -27,6 +27,10 @@ limitations under the License. */ #include "fpga/api.h" #endif +#ifdef PADDLE_MOBILE_CL +#include "framework/cl/cl_image.h" +#endif + namespace paddle_mobile { namespace operators { @@ -71,6 +75,16 @@ struct DtypeTensorTrait { typedef framework::Tensor rtype; }; + +template <> +struct DtypeTensorTrait { + // This is the type we obtained in variable. + typedef framework::CLImage gtype; + // This type will be the parent class type + // or the same type. + typedef framework::CLImage rtype; +}; + class OpParam { protected: template