MCPcopy Create free account
hub / github.com/apache/singa / Col2Im

Method Col2Im

src/model/layer/opencl_convolution.cc:199–221  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

197
198
199void 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

Callers 1

BackwardMethod · 0.95

Calls 2

WrapHandleFunction · 0.85
mutable_dataMethod · 0.80

Tested by

no test coverage detected