From cfaedb38cd662def3b5684a20965b3bc1b0d6a3f Mon Sep 17 00:00:00 2001 From: Eugene Zhulenev Date: Thu, 9 Aug 2018 09:44:07 -0700 Subject: Fix bug in a test + compilation errors --- unsupported/Eigen/CXX11/src/Tensor/TensorExecutor.h | 6 ++++-- unsupported/Eigen/CXX11/src/Tensor/TensorMorphing.h | 8 ++++---- unsupported/test/cxx11_tensor_executor.cpp | 2 +- unsupported/test/cxx11_tensor_shuffling.cpp | 8 ++++---- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorExecutor.h b/unsupported/Eigen/CXX11/src/Tensor/TensorExecutor.h index f11241f83..4bc18bd97 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorExecutor.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorExecutor.h @@ -115,6 +115,7 @@ class TensorExecutor TensorBlock; + typedef typename TensorBlock::Dimensions TensorBlockDimensions; typedef TensorBlockMapper TensorBlockMapper; @@ -141,8 +142,9 @@ class TensorExecutor( diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorMorphing.h b/unsupported/Eigen/CXX11/src/Tensor/TensorMorphing.h index d5b0c1237..b25c1eabc 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorMorphing.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorMorphing.h @@ -520,6 +520,7 @@ struct TensorEvaluator, Devi typedef internal::TensorBlock TensorBlock; + typedef typename TensorBlock::Dimensions TensorBlockDimensions; EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorEvaluator(const XprType& op, const Device& device) : m_impl(op.expression(), device), m_device(device), m_dimensions(op.sizes()), m_offsets(op.startIndices()) @@ -687,7 +688,7 @@ struct TensorEvaluator, Devi TensorBlock input_block(srcCoeff(output_block->first_coeff_index()), output_block->block_sizes(), output_block->block_strides(), - Dimensions(m_inputStrides), + TensorBlockDimensions(m_inputStrides), output_block->data()); m_impl.block(&input_block); } @@ -796,6 +797,7 @@ struct TensorEvaluator, Device> typedef internal::TensorBlock TensorBlock; + typedef typename TensorBlock::Dimensions TensorBlockDimensions; EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorEvaluator(const XprType& op, const Device& device) : Base(op, device) @@ -862,13 +864,11 @@ struct TensorEvaluator, Device> const TensorBlock& block) { this->m_impl.writeBlock(TensorBlock( this->srcCoeff(block.first_coeff_index()), block.block_sizes(), - block.block_strides(), Dimensions(this->m_inputStrides), + block.block_strides(), TensorBlockDimensions(this->m_inputStrides), const_cast(block.data()))); } }; - - namespace internal { template struct traits > : public traits diff --git a/unsupported/test/cxx11_tensor_executor.cpp b/unsupported/test/cxx11_tensor_executor.cpp index 448f47f1d..d16ae4d11 100644 --- a/unsupported/test/cxx11_tensor_executor.cpp +++ b/unsupported/test/cxx11_tensor_executor.cpp @@ -317,7 +317,7 @@ static void test_execute_reshape(Device d) DSizes reshaped_dims; reshaped_dims[shuffle[0]] = dims[0] * dims[1]; - for (int i = 2; i < NumDims; ++i) reshaped_dims[shuffle[i]] = dims[i]; + for (int i = 1; i < ReshapedDims; ++i) reshaped_dims[shuffle[i]] = dims[i + 1]; Tensor golden = src.reshape(reshaped_dims); diff --git a/unsupported/test/cxx11_tensor_shuffling.cpp b/unsupported/test/cxx11_tensor_shuffling.cpp index ab19b6e6b..467df39c7 100644 --- a/unsupported/test/cxx11_tensor_shuffling.cpp +++ b/unsupported/test/cxx11_tensor_shuffling.cpp @@ -83,10 +83,10 @@ static void test_expr_shuffling() Tensor result(5,7,3,2); - array src_slice_dim{{2,3,1,7}}; - array src_slice_start{{0,0,0,0}}; - array dst_slice_dim{{1,7,3,2}}; - array dst_slice_start{{0,0,0,0}}; + array src_slice_dim{{2,3,1,7}}; + array src_slice_start{{0,0,0,0}}; + array dst_slice_dim{{1,7,3,2}}; + array dst_slice_start{{0,0,0,0}}; for (int i = 0; i < 5; ++i) { result.slice(dst_slice_start, dst_slice_dim) = -- cgit v1.2.3