aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported/test
diff options
context:
space:
mode:
authorGravatar Eugene Zhulenev <ezhulenev@google.com>2018-10-25 11:31:29 -0700
committerGravatar Eugene Zhulenev <ezhulenev@google.com>2018-10-25 11:31:29 -0700
commit8a977c1f469df11027ca31efbd246aaa5db5fe65 (patch)
tree288217fd212430e4b36f9c40a169920db4f09311 /unsupported/test
parent1dcf5a6ed8c5878a951b6eb7cbfa473030b3f7a8 (diff)
Fix cxx11_tensor_{block_access, reduction} tests
Diffstat (limited to 'unsupported/test')
-rw-r--r--unsupported/test/cxx11_tensor_block_access.cpp4
-rw-r--r--unsupported/test/cxx11_tensor_reduction.cpp4
2 files changed, 5 insertions, 3 deletions
diff --git a/unsupported/test/cxx11_tensor_block_access.cpp b/unsupported/test/cxx11_tensor_block_access.cpp
index 64b3a1202..0fb189e09 100644
--- a/unsupported/test/cxx11_tensor_block_access.cpp
+++ b/unsupported/test/cxx11_tensor_block_access.cpp
@@ -820,8 +820,8 @@ static void test_block_cwise_binary_io_zero_strides() {
left_strides[4] = 0;
DSizes<Index, 5> right_sizes = rnd_dims;
- right_sizes[1] = 0;
- right_sizes[3] = 0;
+ right_sizes[1] = 1;
+ right_sizes[3] = 1;
DSizes<Index, 5> right_strides(ComputeStrides<Layout, 5>(right_sizes));
right_strides[1] = 0;
diff --git a/unsupported/test/cxx11_tensor_reduction.cpp b/unsupported/test/cxx11_tensor_reduction.cpp
index c0d4c786f..996dba806 100644
--- a/unsupported/test/cxx11_tensor_reduction.cpp
+++ b/unsupported/test/cxx11_tensor_reduction.cpp
@@ -57,6 +57,8 @@ template <typename Scalar,int DataLayout>
static void test_simple_reductions() {
Tensor<Scalar, 4, DataLayout> tensor(2, 3, 5, 7);
tensor.setRandom();
+ // Add a little offset so that the product reductions won't be close to zero.
+ tensor += tensor.constant(Scalar(0.5f));
array<ptrdiff_t, 2> reduction_axis2;
reduction_axis2[0] = 1;
reduction_axis2[1] = 3;
@@ -368,7 +370,7 @@ static void test_static_dims() {
Tensor<float, 2, DataLayout> out(72, 97);
in.setRandom();
-#if !EIGEN_HAS_CONSTEXPR
+#if !EIGEN_HAS_CONSTEXPR
array<int, 2> reduction_axis;
reduction_axis[0] = 1;
reduction_axis[1] = 3;