提交 e0a319ae 编写于 作者: xiebaiyuan's avatar xiebaiyuan

[LITE][OPENCL][Image] use unique_ptr to wrap filter and bias in conv image compute , test=develop

上级 9562d42a
......@@ -81,10 +81,6 @@ class ActivationComputeImageDefault
"image/activation_kernel.cl",
build_options_,
time_stamp_);
STL::stringstream kernel_key;
kernel_key << kernel_func_name_ << build_options_ << time_stamp_;
auto kernel = context.cl_context()->GetKernel(kernel_key.str());
}
void ReInitWhenNeeded() override {
......@@ -119,10 +115,11 @@ class ActivationComputeImageDefault
out_img_shape_[0], out_img_shape_[1]);
auto& context = ctx_->As<OpenCLContext>();
CHECK(context.cl_context() != nullptr);
std::stringstream kernel_key;
kernel_key << kernel_func_name_ << build_options_ << time_stamp_;
auto kernel = context.cl_context()->GetKernel(kernel_key.str());
;
cl_int status;
status = kernel->setArg(0, *x_img);
CL_CHECK_FATAL(status);
......@@ -170,7 +167,6 @@ class ActivationComputeImageDefault
std::string kernel_func_name_{};
float threshold_{6.f};
float scale_{1.f};
cl::Kernel kernel;
bool first_epoch_for_reinit_{true};
cl::NDRange global_work_size_ = cl::NDRange{
static_cast<size_t>(1), static_cast<size_t>(1), static_cast<size_t>(1)};
......
......@@ -108,7 +108,6 @@ class FcCompute
std::stringstream kernel_key;
kernel_key << kernel_func_name_ << build_options_ << time_stamp_;
auto kernel = context.cl_context()->GetKernel(kernel_key.str());
;
cl_int status;
status = kernel->setArg(0, *x_buf);
CL_CHECK_FATAL(status);
......@@ -145,7 +144,7 @@ class FcCompute
bool first_epoch_for_reinit_{true};
DDim last_x_dims_;
cl::NDRange global_work_size_;
cl::Kernel kernel;
std::shared_ptr<cl::Event> event_{new cl::Event};
};
......
......@@ -85,7 +85,6 @@ class ScaleComputeImage2D : public KernelLite<TARGET(kOpenCL),
std::stringstream kernel_key;
kernel_key << kernel_func_name_ << build_options_ << time_stamp_;
auto kernel = context.cl_context()->GetKernel(kernel_key.str());
;
cl_int status;
status = kernel->setArg(0, *x_img);
CL_CHECK_FATAL(status);
......@@ -114,7 +113,7 @@ class ScaleComputeImage2D : public KernelLite<TARGET(kOpenCL),
std::shared_ptr<cl::Event> event_{new cl::Event};
param_t* scale_param_{nullptr};
cl::Kernel kernel;
bool first_epoch_for_reinit_{true};
DDim last_x_dims_;
DDim out_img_shape_ = DDim(std::vector<DDim::value_type>(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册