From 81b38a155adf5d527bce5c84cf90cd83c28da445 Mon Sep 17 00:00:00 2001 From: Eugene Zhulenev Date: Tue, 11 Sep 2018 13:32:32 -0700 Subject: Fix compilation of tiled evaluation code with c++03 --- unsupported/Eigen/CXX11/src/Tensor/TensorBlock.h | 6 +++--- unsupported/Eigen/CXX11/src/Tensor/TensorBroadcasting.h | 11 +++++------ unsupported/Eigen/CXX11/src/Tensor/TensorChipping.h | 5 ++--- unsupported/Eigen/CXX11/src/Tensor/TensorImagePatch.h | 5 ++--- unsupported/Eigen/CXX11/src/Tensor/TensorMorphing.h | 5 ++--- unsupported/Eigen/CXX11/src/Tensor/TensorReduction.h | 5 ++--- unsupported/Eigen/CXX11/src/Tensor/TensorShuffling.h | 4 ++-- unsupported/test/cxx11_tensor_block_access.cpp | 14 +++++++------- unsupported/test/cxx11_tensor_shuffling.cpp | 10 +++++----- 9 files changed, 30 insertions(+), 35 deletions(-) (limited to 'unsupported') diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorBlock.h b/unsupported/Eigen/CXX11/src/Tensor/TensorBlock.h index 6d90af2d3..13da36257 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorBlock.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorBlock.h @@ -396,8 +396,8 @@ struct TensorBlockCwiseUnaryOp { typedef const Eigen::Array Input; typedef Eigen::Array Output; - typedef Eigen::Map> InputMap; - typedef Eigen::Map> OutputMap; + typedef Eigen::Map > InputMap; + typedef Eigen::Map > OutputMap; const InputScalar* input_base = &input_data[input_index]; OutputScalar* output_base = &output_data[output_index]; @@ -502,7 +502,7 @@ struct TensorBlockCwiseUnaryIO { input_stride, input_data); // Update index. for (int j = 0; j < num_squeezed_dims; ++j) { - auto& state = block_iter_state[j]; + BlockIteratorState& state = block_iter_state[j]; if (++state.count < state.size) { output_index += state.output_stride; input_index += state.input_stride; diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorBroadcasting.h b/unsupported/Eigen/CXX11/src/Tensor/TensorBroadcasting.h index 02d061a9c..e5cf93ab0 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorBroadcasting.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorBroadcasting.h @@ -596,12 +596,11 @@ struct TensorEvaluator, Device> std::vector* resources) const { // TODO(wuke): Targeting L1 size is 30% faster than targeting L{-1} on large // tensors. But this might need further tuning. - auto block_total_size_max = numext::maxi( + Eigen::Index block_total_size_max = numext::maxi( 1, m_device.firstLevelCacheSize() / sizeof(Scalar)); resources->push_back(internal::TensorOpResourceRequirements( - internal::TensorBlockShapeType::kSkewedInnerDims, - block_total_size_max)); + internal::kSkewedInnerDims, block_total_size_max)); m_impl.getResourceRequirements(resources); } @@ -617,8 +616,8 @@ struct TensorEvaluator, Device> // equal to m_dimensions for inner dims, a smaller than m_dimensions[i] size // for the first outer dim, and 1 for other outer dims. This is guaranteed // by MergeResourceRequirements() in TensorBlock.h. - const auto& output_block_sizes = output_block->block_sizes(); - const auto& output_block_strides = output_block->block_strides(); + const Dimensions& output_block_sizes = output_block->block_sizes(); + const Dimensions& output_block_strides = output_block->block_strides(); // Find where outer dims start. int outer_dim_start = 0; @@ -642,7 +641,7 @@ struct TensorEvaluator, Device> return; } - const auto& input_dims = m_impl.dimensions(); + const Dimensions& input_dims = m_impl.dimensions(); // Pre-fill input_block_sizes, broadcast_block_sizes, // broadcast_block_strides, and broadcast_tensor_strides. Later on we will diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorChipping.h b/unsupported/Eigen/CXX11/src/Tensor/TensorChipping.h index 76fab39e2..b47fa9e8e 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorChipping.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorChipping.h @@ -290,11 +290,10 @@ struct TensorEvaluator, Device> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void getResourceRequirements( std::vector* resources) const { - auto block_total_size_max = numext::maxi( + Eigen::Index block_total_size_max = numext::maxi( 1, m_device.lastLevelCacheSize() / sizeof(Scalar)); resources->push_back(internal::TensorOpResourceRequirements( - internal::TensorBlockShapeType::kSkewedInnerDims, - block_total_size_max)); + internal::kSkewedInnerDims, block_total_size_max)); m_impl.getResourceRequirements(resources); } diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorImagePatch.h b/unsupported/Eigen/CXX11/src/Tensor/TensorImagePatch.h index 1826d7022..965bd8f1e 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorImagePatch.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorImagePatch.h @@ -550,11 +550,10 @@ struct TensorEvaluator, Device> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void getResourceRequirements( std::vector* resources) const { - auto block_total_size_max = numext::maxi( + Eigen::Index block_total_size_max = numext::maxi( 1, m_device.lastLevelCacheSize() / sizeof(Scalar)); resources->push_back(internal::TensorOpResourceRequirements( - internal::TensorBlockShapeType::kSkewedInnerDims, - block_total_size_max)); + internal::kSkewedInnerDims, block_total_size_max)); } EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void block( diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorMorphing.h b/unsupported/Eigen/CXX11/src/Tensor/TensorMorphing.h index 2f765acb7..16dc74afe 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorMorphing.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorMorphing.h @@ -677,11 +677,10 @@ struct TensorEvaluator, Devi EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void getResourceRequirements( std::vector* resources) const { - auto block_total_size_max = numext::maxi( + Eigen::Index block_total_size_max = numext::maxi( 1, m_device.lastLevelCacheSize() / sizeof(Scalar)); resources->push_back(internal::TensorOpResourceRequirements( - internal::TensorBlockShapeType::kSkewedInnerDims, - block_total_size_max)); + internal::kSkewedInnerDims, block_total_size_max)); m_impl.getResourceRequirements(resources); } diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorReduction.h b/unsupported/Eigen/CXX11/src/Tensor/TensorReduction.h index 3d534eaa2..eeb2578fd 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorReduction.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorReduction.h @@ -771,11 +771,10 @@ struct TensorEvaluator, EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void getResourceRequirements( std::vector* resources) const { - auto block_total_size_max = numext::maxi( + Eigen::Index block_total_size_max = numext::maxi( 1, m_device.lastLevelCacheSize() / sizeof(Scalar)); resources->push_back(internal::TensorOpResourceRequirements( - internal::TensorBlockShapeType::kSkewedInnerDims, - block_total_size_max)); + internal::kSkewedInnerDims, block_total_size_max)); m_impl.getResourceRequirements(resources); } diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorShuffling.h b/unsupported/Eigen/CXX11/src/Tensor/TensorShuffling.h index a5b541a68..e018d0ab2 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorShuffling.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorShuffling.h @@ -229,10 +229,10 @@ struct TensorEvaluator, Device> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void getResourceRequirements( std::vector* resources) const { - auto block_total_size_max = numext::maxi( + Eigen::Index block_total_size_max = numext::maxi( 1, m_device.firstLevelCacheSize() / sizeof(Scalar)); resources->push_back(internal::TensorOpResourceRequirements( - internal::TensorBlockShapeType::kUniformAllDims, block_total_size_max)); + internal::kUniformAllDims, block_total_size_max)); m_impl.getResourceRequirements(resources); } diff --git a/unsupported/test/cxx11_tensor_block_access.cpp b/unsupported/test/cxx11_tensor_block_access.cpp index eec282ba7..ad12ae557 100644 --- a/unsupported/test/cxx11_tensor_block_access.cpp +++ b/unsupported/test/cxx11_tensor_block_access.cpp @@ -535,7 +535,7 @@ static void test_block_cwise_unary_io_basic() { DSizes block_sizes = RandomDims(); DSizes strides(ComputeStrides(block_sizes)); - const auto total_size = block_sizes.TotalSize(); + const Index total_size = block_sizes.TotalSize(); // Create a random input tensors. T* input_data = GenerateRandomData(total_size); @@ -562,12 +562,12 @@ static void test_block_cwise_unary_io_squeeze_ones() { DSizes block_sizes(1, 2, 1, 3, 1); DSizes strides(ComputeStrides(block_sizes)); - const auto total_size = block_sizes.TotalSize(); + const Index total_size = block_sizes.TotalSize(); // Create a random input tensors. - auto* input_data = GenerateRandomData(total_size); + float* input_data = GenerateRandomData(total_size); - auto* output_data = new float[total_size]; + float* output_data = new float[total_size]; UnaryFunctor functor; TensorBlockCwiseUnaryIO::Run(functor, block_sizes, strides, output_data, strides, input_data); @@ -599,13 +599,13 @@ static void test_block_cwise_unary_io_zero_strides() { input_strides[4] = 0; // Generate random data. - auto* input_data = GenerateRandomData(input_sizes.TotalSize()); + float* input_data = GenerateRandomData(input_sizes.TotalSize()); DSizes output_sizes = rnd_dims; DSizes output_strides(ComputeStrides(output_sizes)); - const auto output_total_size = output_sizes.TotalSize(); - auto* output_data = new float[output_total_size]; + const Index output_total_size = output_sizes.TotalSize(); + float* output_data = new float[output_total_size]; UnaryFunctor functor; TensorBlockCwiseUnaryIO::Run(functor, output_sizes, output_strides, diff --git a/unsupported/test/cxx11_tensor_shuffling.cpp b/unsupported/test/cxx11_tensor_shuffling.cpp index 467df39c7..062dd1c0f 100644 --- a/unsupported/test/cxx11_tensor_shuffling.cpp +++ b/unsupported/test/cxx11_tensor_shuffling.cpp @@ -81,12 +81,12 @@ static void test_expr_shuffling() Tensor expected; expected = tensor.shuffle(shuffles); - Tensor result(5,7,3,2); + 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