aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported/test/cxx11_tensor_contract_sycl.cpp
diff options
context:
space:
mode:
authorGravatar Mehdi Goli <mehdi.goli@codeplay.com>2017-01-19 11:30:59 +0000
committerGravatar Mehdi Goli <mehdi.goli@codeplay.com>2017-01-19 11:30:59 +0000
commit6bdd15f572c0b8cd21f5acba3671d536f50a9b53 (patch)
tree8343c43748cfbdefdac6e7b4e52aec7196669589 /unsupported/test/cxx11_tensor_contract_sycl.cpp
parente46e7223817cfd982edec6d8e25c77e8e2493d78 (diff)
Adding non-deferrenciable pointer track for ComputeCpp backend; Adding TensorConvolutionOp for ComputeCpp; fixing typos. modifying TensorDeviceSycl to use the LegacyPointer class.
Diffstat (limited to 'unsupported/test/cxx11_tensor_contract_sycl.cpp')
-rw-r--r--unsupported/test/cxx11_tensor_contract_sycl.cpp13
1 files changed, 7 insertions, 6 deletions
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<float, 1>::DimensionPair DimPair;
template<int DataLayout, typename Device>
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<float>(fabs(t_result(i) - t_result_gpu(i))) < 1e-4f) {
+ if (static_cast<float>(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<float>(fabs(t_result(i) - t_result_gpu(i))) < 1e-4f) {
+ if (static_cast<float>(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<float>(fabs(t_result() - t_result_gpu())) > 1e-4f &&
- !Eigen::internal::isApprox(t_result(), t_result_gpu(), 1e-4f)) {
+ if (static_cast<float>(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);