From c652410ab2e131fa653e2f7c7f6438549da04d7f Mon Sep 17 00:00:00 2001 From: yangfei Date: Mon, 15 Oct 2018 21:14:43 +0800 Subject: [PATCH] imp feed op --- src/framework/cl/cl_image.h | 11 ----------- src/operators/kernel/cl/feed_kernel.cpp | 2 +- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/src/framework/cl/cl_image.h b/src/framework/cl/cl_image.h index e9bef70198..cc887741ce 100644 --- a/src/framework/cl/cl_image.h +++ b/src/framework/cl/cl_image.h @@ -124,18 +124,7 @@ class CLImage { tensor_dims_ = dim; if (tensor_data) { tensor_data_ = tensor_data; - } else { - int numel = 1; - for (int i = 0; i < dim.size(); i++) { - numel *= dim[i]; - } - tensor_data_ = static_cast( - paddle_mobile::memory::Alloc(sizeof(float) * numel)); - for (int i = 0; i < numel; i++) { - tensor_data_[i] = 0; - } } - size_t new_dims[] = {1, 1, 1, 1}; for (int j = 0; j < dim.size(); ++j) { diff --git a/src/operators/kernel/cl/feed_kernel.cpp b/src/operators/kernel/cl/feed_kernel.cpp index d12dcdbdce..467886a34b 100644 --- a/src/operators/kernel/cl/feed_kernel.cpp +++ b/src/operators/kernel/cl/feed_kernel.cpp @@ -61,7 +61,7 @@ void FeedKernel::Compute(const FeedParam ¶m) { size_t region[3] = {height, width, 1}; clEnqueueReadImage(commandQueue, cl_image, CL_TRUE, origin, region, 0, 0, out, 0, NULL, NULL); - for (int i = 0; i < numel; i++) DLOG << Half2Float(out[i]); + for (int i = 0; i < numel; i++) DLOG << Half2Float(out[i])<<","<; -- GitLab