| 197 | |
| 198 | |
| 199 | void OpenclConvolution::Col2Im(Block* src, const int col_data_off, |
| 200 | const int height, const int width, |
| 201 | const int kernel_h, const int kernel_w, |
| 202 | const int pad_h, const int pad_w, |
| 203 | const int stride_h, const int stride_w, |
| 204 | const int conv_h, const int conv_w, |
| 205 | const int data_im_off, const int channels, |
| 206 | Block* dst, Context* ctx) { |
| 207 | |
| 208 | auto ocl_ctx = viennacl::ocl::get_context(ctx->vcl_ctx_id); |
| 209 | auto kernel = ocl_ctx.get_kernel("opencl_im2col", "col2im"); |
| 210 | |
| 211 | auto src_buf = WrapHandle(static_cast<cl_mem>(src->mutable_data()), ocl_ctx); |
| 212 | auto dst_buf = WrapHandle(static_cast<cl_mem>(dst->mutable_data()), ocl_ctx); |
| 213 | |
| 214 | int num_kernels = channels * height * width; |
| 215 | |
| 216 | viennacl::ocl::enqueue(kernel(num_kernels, src_buf, col_data_off, channels, |
| 217 | height, width, kernel_h, kernel_w, |
| 218 | pad_h, pad_w, stride_h, stride_w, |
| 219 | 1, 1, conv_h, conv_w, |
| 220 | dst_buf, data_im_off)); |
| 221 | } |
| 222 | |
| 223 | |
| 224 | } // namespace singa |
no test coverage detected