From 6bdd15f572c0b8cd21f5acba3671d536f50a9b53 Mon Sep 17 00:00:00 2001 From: Mehdi Goli Date: Thu, 19 Jan 2017 11:30:59 +0000 Subject: Adding non-deferrenciable pointer track for ComputeCpp backend; Adding TensorConvolutionOp for ComputeCpp; fixing typos. modifying TensorDeviceSycl to use the LegacyPointer class. --- unsupported/test/cxx11_tensor_contract_sycl.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'unsupported/test/cxx11_tensor_contract_sycl.cpp') diff --git a/unsupported/test/cxx11_tensor_contract_sycl.cpp b/unsupported/test/cxx11_tensor_contract_sycl.cpp index 5dacc87f2..cb8fcb74c 100644 --- a/unsupported/test/cxx11_tensor_contract_sycl.cpp +++ b/unsupported/test/cxx11_tensor_contract_sycl.cpp @@ -28,6 +28,7 @@ using Eigen::array; using Eigen::SyclDevice; using Eigen::Tensor; using Eigen::TensorMap; +static const float error_threshold =1e-4f; typedef Tensor::DimensionPair DimPair; template void test_sycl_contraction(const Device& sycl_device, int m_size, int k_size, int n_size) @@ -70,10 +71,10 @@ void test_sycl_contraction(const Device& sycl_device, int m_size, int k_size, in t_result = t_left.contract(t_right, dims); for (DenseIndex i = 0; i < t_result.size(); i++) { - if (static_cast(fabs(t_result(i) - t_result_gpu(i))) < 1e-4f) { + if (static_cast(fabs(t_result(i) - t_result_gpu(i))) < error_threshold) { continue; } - if (Eigen::internal::isApprox(t_result(i), t_result_gpu(i), 1e-4f)) { + if (Eigen::internal::isApprox(t_result(i), t_result_gpu(i), error_threshold)) { continue; } std::cout << "mismatch detected at index " << i << ": " << t_result(i) @@ -132,10 +133,10 @@ void test_TF(const Device& sycl_device) t_result = t_left.contract(t_right, dims); for (DenseIndex i = 0; i < t_result.size(); i++) { - if (static_cast(fabs(t_result(i) - t_result_gpu(i))) < 1e-4f) { + if (static_cast(fabs(t_result(i) - t_result_gpu(i))) < error_threshold) { continue; } - if (Eigen::internal::isApprox(t_result(i), t_result_gpu(i), 1e-4f)) { + if (Eigen::internal::isApprox(t_result(i), t_result_gpu(i), error_threshold)) { continue; } std::cout << "mismatch detected at index " << i << ": " << t_result(i) @@ -187,8 +188,8 @@ void test_scalar(const Device& sycl_device, int m_size, int k_size, int n_size) t_result = t_left.contract(t_right, dims); - if (static_cast(fabs(t_result() - t_result_gpu())) > 1e-4f && - !Eigen::internal::isApprox(t_result(), t_result_gpu(), 1e-4f)) { + if (static_cast(fabs(t_result() - t_result_gpu())) > error_threshold && + !Eigen::internal::isApprox(t_result(), t_result_gpu(), error_threshold)) { std::cout << "mismatch detected: " << t_result() << " vs " << t_result_gpu() << std::endl; assert(false); -- cgit v1.2.3