From 0b3d04f70902e00f86c572a5e3c379f9335b216f Mon Sep 17 00:00:00 2001 From: Koichi Akabe Date: Tue, 30 Oct 2018 14:54:55 +0900 Subject: Fix col2im implementation --- test/routines/levelx/xcol2im.hpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'test/routines/levelx/xcol2im.hpp') diff --git a/test/routines/levelx/xcol2im.hpp b/test/routines/levelx/xcol2im.hpp index 7393c432..13e70a5f 100644 --- a/test/routines/levelx/xcol2im.hpp +++ b/test/routines/levelx/xcol2im.hpp @@ -159,6 +159,15 @@ StatusCode RunReference(const Arguments &args, BuffersHost &buffers_host) // Reference taken from im2col but swapped the input/output const auto col_h = TestXcol2im::ColHeight(args); const auto col_w = TestXcol2im::ColWidth(args); + + for (auto c_id = size_t{0}; c_id < args.channels; ++c_id) { + for (auto h_index = size_t{0}; h_index < args.height; ++h_index) { + for (auto w_index = size_t{0}; w_index < args.width; ++w_index) { + const auto im_index = w_index + args.width * (h_index + args.height * c_id); + buffers_host.a_mat[im_index + args.a_offset] = 0; + } + } + } for (auto c_id = size_t{0}; c_id < args.channels; ++c_id) { // image channels for (auto kh_id = size_t{0}; kh_id < args.kernel_h; ++kh_id) { // kernel height for (auto kw_id = size_t{0}; kw_id < args.kernel_w; ++kw_id) { // kernel width @@ -178,7 +187,7 @@ StatusCode RunReference(const Arguments &args, BuffersHost &buffers_host) if (h_index >= 0 && h_index < args.height && w_index >= 0 && w_index < args.width) { const auto im_index = w_index + args.width * (h_index + args.height * c_id); - buffers_host.a_mat[im_index + args.a_offset] = val; + buffers_host.a_mat[im_index + args.a_offset] += val; } } } -- cgit v1.2.3