From 166b56bc613e89a3e93f8c08912f15bd507d2351 Mon Sep 17 00:00:00 2001 From: Benoit Steiner Date: Thu, 7 Apr 2016 22:45:54 -0700 Subject: [PATCH] Fixed the type casting benchmark for float16 --- bench/tensors/tensor_benchmarks.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bench/tensors/tensor_benchmarks.h b/bench/tensors/tensor_benchmarks.h index 16b388abf..8fe211602 100644 --- a/bench/tensors/tensor_benchmarks.h +++ b/bench/tensors/tensor_benchmarks.h @@ -48,6 +48,10 @@ template class BenchmarkSuite { Eigen::array sizes; sizes[0] = m_; sizes[1] = k_; + if (sizeof(T) < sizeof(int)) { + sizes[0] = m_ * sizeof(T) / sizeof(int); + sizes[1] = k_ * sizeof(T) / sizeof(int); + } const TensorMap, Eigen::Aligned> A((int*)a_, sizes); TensorMap, Eigen::Aligned> B(b_, sizes);