diff options
author | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2016-05-05 16:36:39 -0700 |
---|---|---|
committer | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2016-05-05 16:36:39 -0700 |
commit | 678a17ba796aa757e542e6d633c15574ef6fb586 (patch) | |
tree | eb8717c81e66ae99bed7bcf938ef804b10045ea3 /unsupported | |
parent | e3d053e14ea625ccd3bb666a535f063cd43d806a (diff) |
Made the testing of contractions on fp16 more robust
Diffstat (limited to 'unsupported')
-rw-r--r-- | unsupported/test/cxx11_tensor_of_float16_cuda.cu | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/unsupported/test/cxx11_tensor_of_float16_cuda.cu b/unsupported/test/cxx11_tensor_of_float16_cuda.cu index 39a28501b..443373d4e 100644 --- a/unsupported/test/cxx11_tensor_of_float16_cuda.cu +++ b/unsupported/test/cxx11_tensor_of_float16_cuda.cu @@ -219,7 +219,7 @@ void test_cuda_contractions() { d_res_float, rows, cols); gpu_float1.device(gpu_device) = gpu_float1.random() - gpu_float1.constant(0.5f); - gpu_float2.device(gpu_device) = gpu_float2.random() - gpu_float1.constant(0.5f); + gpu_float2.device(gpu_device) = gpu_float2.random() - gpu_float2.constant(0.5f); typedef Tensor<float, 2>::DimensionPair DimPair; Eigen::array<DimPair, 1> dims(DimPair(1, 0)); @@ -234,8 +234,10 @@ void test_cuda_contractions() { for (int i = 0; i < rows; ++i) { for (int j = 0; j < cols; ++j) { - std::cout << "Checking contract " << i << " " << j << std::endl; - VERIFY_IS_APPROX(full_prec(i, j), half_prec(i, j)); + std::cout << "Checking contract " << i << " " << j << full_prec(i, j) << " " << half_prec(i, j) << std::endl; + if (numext::abs(full_prec(i, j) - half_prec(i, j)) > Eigen::half(1e-2f)) { + VERIFY_IS_APPROX(full_prec(i, j), half_prec(i, j)); + } } } |