提交 c652410a 编写于 作者: Y yangfei

imp feed op

上级 f3fe2493
...@@ -124,18 +124,7 @@ class CLImage { ...@@ -124,18 +124,7 @@ class CLImage {
tensor_dims_ = dim; tensor_dims_ = dim;
if (tensor_data) { if (tensor_data) {
tensor_data_ = 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<float *>(
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}; size_t new_dims[] = {1, 1, 1, 1};
for (int j = 0; j < dim.size(); ++j) { for (int j = 0; j < dim.size(); ++j) {
......
...@@ -61,7 +61,7 @@ void FeedKernel<GPU_CL, float>::Compute(const FeedParam<GPU_CL> &param) { ...@@ -61,7 +61,7 @@ void FeedKernel<GPU_CL, float>::Compute(const FeedParam<GPU_CL> &param) {
size_t region[3] = {height, width, 1}; size_t region[3] = {height, width, 1};
clEnqueueReadImage(commandQueue, cl_image, CL_TRUE, origin, region, 0, 0, out, clEnqueueReadImage(commandQueue, cl_image, CL_TRUE, origin, region, 0, 0, out,
0, NULL, NULL); 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])<<","<<i;
} }
template class FeedKernel<GPU_CL, float>; template class FeedKernel<GPU_CL, float>;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册