提交 78de085a 编写于 作者: L liuruilong

use image in param

上级 05286f5b
......@@ -47,9 +47,6 @@ class CLHelper {
return scope_->Context();
}
private:
CLScope *scope_;
std::vector<std::unique_ptr<_cl_kernel, CLKernelDeleter>> kernels;
......
......@@ -32,7 +32,9 @@ class CLImage {
}
const DDim &TensorDim();
const DDim &TensorDim() {
return tensorDims_;
}
std::vector<size_t> 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
......@@ -16,6 +16,7 @@ limitations under the License. */
#include <operators/math/gemm.h>
#include <algorithm>
#include <vector>
#include <framework/cl/cl_image.h>
#include "common/enforce.h"
#include "common/log.h"
#include "framework/framework.pb-c.h"
......@@ -233,6 +234,7 @@ void Executor<Dtype, P>::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) {
......
......@@ -31,7 +31,6 @@ void ConvKernel<GPU_CL, float>::Compute(const ConvParam<GPU_CL> &param) {
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<GPU_CL, float>;
......
......@@ -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<GPU_MALI> {
typedef framework::Tensor rtype;
};
template <>
struct DtypeTensorTrait<GPU_CL> {
// 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 <typename T>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册