summaryrefslogtreecommitdiff
path: root/test/routines/levelx/xim2col.hpp
diff options
context:
space:
mode:
authorCedric Nugteren <web@cedricnugteren.nl>2018-11-01 21:44:21 +0100
committerCedric Nugteren <web@cedricnugteren.nl>2018-11-01 21:44:21 +0100
commit469c346a8e0b2be9f3c736c39760548b1749918c (patch)
treeed80ebc5a86d5231ea66f78f35dd8d51eb7f2f66 /test/routines/levelx/xim2col.hpp
parent4215bbe62a03a84c09d3abb6c24b9e6eee0b5007 (diff)
Fixed half-precision tests for im2col and col2im
Diffstat (limited to 'test/routines/levelx/xim2col.hpp')
-rw-r--r--test/routines/levelx/xim2col.hpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/routines/levelx/xim2col.hpp b/test/routines/levelx/xim2col.hpp
index 9fd2af0c..acf7998b 100644
--- a/test/routines/levelx/xim2col.hpp
+++ b/test/routines/levelx/xim2col.hpp
@@ -188,6 +188,26 @@ StatusCode RunReference(const Arguments<T> &args, BuffersHost<T> &buffers_host)
return StatusCode::kSuccess;
}
+// Half-precision version calling the above reference implementation after conversions
+template <>
+StatusCode RunReference<half>(const Arguments<half> &args, BuffersHost<half> &buffers_host) {
+ auto a_buffer2 = HalfToFloatBuffer(buffers_host.a_mat);
+ auto b_buffer2 = HalfToFloatBuffer(buffers_host.b_mat);
+ auto dummy = std::vector<float>(0);
+ auto buffers2 = BuffersHost<float>{dummy, dummy, a_buffer2, b_buffer2, dummy, dummy, dummy};
+ auto args2 = Arguments<float>();
+ args2.a_size = args.a_size; args2.b_size = args.b_size;
+ args2.channels = args.channels; args2.height = args.height; args2.width = args.width;
+ args2.kernel_h = args.kernel_h; args2.kernel_w = args.kernel_w;
+ args2.pad_h = args.pad_h; args2.pad_w = args.pad_w;
+ args2.stride_h = args.stride_h; args2.stride_w = args.stride_w;
+ args2.dilation_h = args.dilation_h; args2.dilation_w = args.dilation_w;
+ args2.a_offset = args.a_offset; args2.b_offset = args.b_offset;
+ auto status = RunReference(args2, buffers2);
+ FloatToHalfBuffer(buffers_host.b_mat, buffers2.b_mat);
+ return status;
+}
+
// =================================================================================================
} // namespace clblast