From 1c879eb010df8e53e5ac016ee5d155db2c721c2b Mon Sep 17 00:00:00 2001 From: Eugene Zhulenev Date: Tue, 10 Dec 2019 15:40:23 -0800 Subject: Remove V2 suffix from TensorBlock --- unsupported/test/cxx11_tensor_block_access.cpp | 68 +++++++++++++------------- unsupported/test/cxx11_tensor_block_eval.cpp | 8 +-- unsupported/test/cxx11_tensor_block_io.cpp | 26 +++++----- 3 files changed, 51 insertions(+), 51 deletions(-) (limited to 'unsupported/test') diff --git a/unsupported/test/cxx11_tensor_block_access.cpp b/unsupported/test/cxx11_tensor_block_access.cpp index b56601ebd..33dc2535a 100644 --- a/unsupported/test/cxx11_tensor_block_access.cpp +++ b/unsupported/test/cxx11_tensor_block_access.cpp @@ -19,7 +19,7 @@ using Eigen::Tensor; using Eigen::Index; using Eigen::RowMajor; using Eigen::ColMajor; -using Eigen::internal::TensorBlockV2ShapeType; +using Eigen::internal::TensorBlockShapeType; template @@ -27,10 +27,10 @@ static const T& choose(int layout, const T& col, const T& row) { return layout == ColMajor ? col : row; } -static TensorBlockV2ShapeType RandomShape() { +static TensorBlockShapeType RandomShape() { return internal::random() - ? TensorBlockV2ShapeType::kUniformAllDims - : TensorBlockV2ShapeType::kSkewedInnerDims; + ? TensorBlockShapeType::kUniformAllDims + : TensorBlockShapeType::kSkewedInnerDims; } template @@ -67,13 +67,13 @@ static void Debug(DSizes dims) { template static void test_block_mapper_sanity() { - typedef internal::TensorBlockV2Mapper<2, Layout> TensorBlockMapper; + typedef internal::TensorBlockMapper<2, Layout> TensorBlockMapper; DSizes tensor_dims(100, 100); // Test uniform blocks. TensorBlockMapper uniform_block_mapper( - tensor_dims, {TensorBlockV2ShapeType::kUniformAllDims, 100}); + tensor_dims, {TensorBlockShapeType::kUniformAllDims, 100}); VERIFY_IS_EQUAL(uniform_block_mapper.blockCount(), 100); VERIFY_IS_EQUAL(uniform_block_mapper.blockTotalSize(), 100); @@ -85,7 +85,7 @@ static void test_block_mapper_sanity() // Test skewed to inner dims blocks. TensorBlockMapper skewed_block_mapper( - tensor_dims, {TensorBlockV2ShapeType::kSkewedInnerDims, 100}); + tensor_dims, {TensorBlockShapeType::kSkewedInnerDims, 100}); VERIFY_IS_EQUAL(skewed_block_mapper.blockCount(), 100); VERIFY_IS_EQUAL(skewed_block_mapper.blockTotalSize(), 100); @@ -121,7 +121,7 @@ static void UpdateCoeffSet( template static void test_block_mapper_maps_every_element() { - typedef internal::TensorBlockV2Mapper TensorBlockMapper; + typedef internal::TensorBlockMapper TensorBlockMapper; DSizes dims = RandomDims(); DSizes strides = internal::strides(dims); @@ -227,14 +227,14 @@ template static void test_uniform_block_shape() { typedef internal::TensorBlockDescriptor<5> TensorBlock; - typedef internal::TensorBlockV2Mapper<5, Layout> TensorBlockMapper; + typedef internal::TensorBlockMapper<5, Layout> TensorBlockMapper; { // Test shape 'UniformAllDims' with uniform 'max_coeff count'. DSizes dims(11, 5, 6, 17, 7); const Index max_coeff_count = 5 * 5 * 5 * 5 * 5; TensorBlockMapper - block_mapper(dims, {TensorBlockV2ShapeType::kUniformAllDims, + block_mapper(dims, {TensorBlockShapeType::kUniformAllDims, max_coeff_count}); TensorBlock block = block_mapper.blockDescriptor(0); for (int i = 0; i < 5; ++i) { @@ -249,7 +249,7 @@ static void test_uniform_block_shape() DSizes dims(11, 5, 6, 17, 7); const Index max_coeff_count = 7 * 5 * 5 * 5 * 5; TensorBlockMapper - block_mapper(dims, {TensorBlockV2ShapeType::kUniformAllDims, + block_mapper(dims, {TensorBlockShapeType::kUniformAllDims, max_coeff_count}); TensorBlock block = block_mapper.blockDescriptor(0); VERIFY_IS_EQUAL(7, block.dimensions()[0]); @@ -261,7 +261,7 @@ static void test_uniform_block_shape() DSizes dims(11, 5, 6, 17, 7); const Index max_coeff_count = 5 * 5 * 5 * 5 * 6; TensorBlockMapper - block_mapper(dims, {TensorBlockV2ShapeType::kUniformAllDims, + block_mapper(dims, {TensorBlockShapeType::kUniformAllDims, max_coeff_count}); TensorBlock block = block_mapper.blockDescriptor(0); VERIFY_IS_EQUAL(6, block.dimensions()[4]); @@ -277,7 +277,7 @@ static void test_uniform_block_shape() DSizes dims(11, 5, 6, 17, 7); const Index max_coeff_count = 11 * 5 * 5 * 5 * 5; TensorBlockMapper - block_mapper(dims, {TensorBlockV2ShapeType::kUniformAllDims, + block_mapper(dims, {TensorBlockShapeType::kUniformAllDims, max_coeff_count}); TensorBlock block = block_mapper.blockDescriptor(0); VERIFY_IS_EQUAL(11, block.dimensions()[0]); @@ -289,7 +289,7 @@ static void test_uniform_block_shape() DSizes dims(11, 5, 6, 17, 7); const Index max_coeff_count = 5 * 5 * 5 * 5 * 7; TensorBlockMapper - block_mapper(dims, {TensorBlockV2ShapeType::kUniformAllDims, + block_mapper(dims, {TensorBlockShapeType::kUniformAllDims, max_coeff_count}); TensorBlock block = block_mapper.blockDescriptor(0); VERIFY_IS_EQUAL(7, block.dimensions()[4]); @@ -305,7 +305,7 @@ static void test_uniform_block_shape() DSizes dims(7, 5, 6, 17, 7); const Index max_coeff_count = 7 * 5 * 6 * 7 * 5; TensorBlockMapper - block_mapper(dims, {TensorBlockV2ShapeType::kUniformAllDims, + block_mapper(dims, {TensorBlockShapeType::kUniformAllDims, max_coeff_count}); TensorBlock block = block_mapper.blockDescriptor(0); VERIFY_IS_EQUAL(7, block.dimensions()[0]); @@ -318,7 +318,7 @@ static void test_uniform_block_shape() DSizes dims(7, 5, 6, 9, 7); const Index max_coeff_count = 5 * 5 * 5 * 6 * 7; TensorBlockMapper - block_mapper(dims, {TensorBlockV2ShapeType::kUniformAllDims, + block_mapper(dims, {TensorBlockShapeType::kUniformAllDims, max_coeff_count}); TensorBlock block = block_mapper.blockDescriptor(0); VERIFY_IS_EQUAL(7, block.dimensions()[4]); @@ -334,7 +334,7 @@ static void test_uniform_block_shape() DSizes dims(7, 5, 6, 17, 7); const Index max_coeff_count = 7 * 5 * 6 * 17 * 7; TensorBlockMapper - block_mapper(dims, {TensorBlockV2ShapeType::kUniformAllDims, + block_mapper(dims, {TensorBlockShapeType::kUniformAllDims, max_coeff_count}); TensorBlock block = block_mapper.blockDescriptor(0); VERIFY_IS_EQUAL(7, block.dimensions()[0]); @@ -347,7 +347,7 @@ static void test_uniform_block_shape() DSizes dims(7, 5, 6, 9, 7); const Index max_coeff_count = 7 * 5 * 6 * 9 * 7; TensorBlockMapper - block_mapper(dims, {TensorBlockV2ShapeType::kUniformAllDims, + block_mapper(dims, {TensorBlockShapeType::kUniformAllDims, max_coeff_count}); TensorBlock block = block_mapper.blockDescriptor(0); VERIFY_IS_EQUAL(7, block.dimensions()[4]); @@ -363,14 +363,14 @@ template static void test_skewed_inner_dim_block_shape() { typedef internal::TensorBlockDescriptor<5> TensorBlock; - typedef internal::TensorBlockV2Mapper<5, Layout> TensorBlockMapper; + typedef internal::TensorBlockMapper<5, Layout> TensorBlockMapper; // Test shape 'SkewedInnerDims' with partial allocation to inner-most dim. if (Layout == ColMajor) { DSizes dims(11, 5, 6, 17, 7); const Index max_coeff_count = 10 * 1 * 1 * 1 * 1; TensorBlockMapper - block_mapper(dims, {TensorBlockV2ShapeType::kSkewedInnerDims, + block_mapper(dims, {TensorBlockShapeType::kSkewedInnerDims, max_coeff_count}); TensorBlock block = block_mapper.blockDescriptor(0); VERIFY_IS_EQUAL(10, block.dimensions()[0]); @@ -382,7 +382,7 @@ static void test_skewed_inner_dim_block_shape() DSizes dims(11, 5, 6, 17, 7); const Index max_coeff_count = 1 * 1 * 1 * 1 * 6; TensorBlockMapper - block_mapper(dims, {TensorBlockV2ShapeType::kSkewedInnerDims, + block_mapper(dims, {TensorBlockShapeType::kSkewedInnerDims, max_coeff_count}); TensorBlock block = block_mapper.blockDescriptor(0); VERIFY_IS_EQUAL(6, block.dimensions()[4]); @@ -397,7 +397,7 @@ static void test_skewed_inner_dim_block_shape() DSizes dims(11, 5, 6, 17, 7); const Index max_coeff_count = 11 * 1 * 1 * 1 * 1; TensorBlockMapper - block_mapper(dims, {TensorBlockV2ShapeType::kSkewedInnerDims, + block_mapper(dims, {TensorBlockShapeType::kSkewedInnerDims, max_coeff_count}); TensorBlock block = block_mapper.blockDescriptor(0); VERIFY_IS_EQUAL(11, block.dimensions()[0]); @@ -409,7 +409,7 @@ static void test_skewed_inner_dim_block_shape() DSizes dims(11, 5, 6, 17, 7); const Index max_coeff_count = 1 * 1 * 1 * 1 * 7; TensorBlockMapper - block_mapper(dims, {TensorBlockV2ShapeType::kSkewedInnerDims, + block_mapper(dims, {TensorBlockShapeType::kSkewedInnerDims, max_coeff_count}); TensorBlock block = block_mapper.blockDescriptor(0); VERIFY_IS_EQUAL(7, block.dimensions()[4]); @@ -425,7 +425,7 @@ static void test_skewed_inner_dim_block_shape() DSizes dims(11, 5, 6, 17, 7); const Index max_coeff_count = 11 * 3 * 1 * 1 * 1; TensorBlockMapper - block_mapper(dims, {TensorBlockV2ShapeType::kSkewedInnerDims, + block_mapper(dims, {TensorBlockShapeType::kSkewedInnerDims, max_coeff_count}); TensorBlock block = block_mapper.blockDescriptor(0); VERIFY_IS_EQUAL(11, block.dimensions()[0]); @@ -438,7 +438,7 @@ static void test_skewed_inner_dim_block_shape() DSizes dims(11, 5, 6, 17, 7); const Index max_coeff_count = 1 * 1 * 1 * 15 * 7; TensorBlockMapper - block_mapper(dims, {TensorBlockV2ShapeType::kSkewedInnerDims, + block_mapper(dims, {TensorBlockShapeType::kSkewedInnerDims, max_coeff_count}); TensorBlock block = block_mapper.blockDescriptor(0); VERIFY_IS_EQUAL(7, block.dimensions()[4]); @@ -455,7 +455,7 @@ static void test_skewed_inner_dim_block_shape() DSizes dims(11, 5, 6, 17, 7); const Index max_coeff_count = 11 * 5 * 5 * 1 * 1; TensorBlockMapper - block_mapper(dims, {TensorBlockV2ShapeType::kSkewedInnerDims, + block_mapper(dims, {TensorBlockShapeType::kSkewedInnerDims, max_coeff_count}); TensorBlock block = block_mapper.blockDescriptor(0); VERIFY_IS_EQUAL(11, block.dimensions()[0]); @@ -469,7 +469,7 @@ static void test_skewed_inner_dim_block_shape() DSizes dims(11, 5, 6, 17, 7); const Index max_coeff_count = 1 * 1 * 5 * 17 * 7; TensorBlockMapper - block_mapper(dims, {TensorBlockV2ShapeType::kSkewedInnerDims, + block_mapper(dims, {TensorBlockShapeType::kSkewedInnerDims, max_coeff_count}); TensorBlock block = block_mapper.blockDescriptor(0); VERIFY_IS_EQUAL(7, block.dimensions()[4]); @@ -486,7 +486,7 @@ static void test_skewed_inner_dim_block_shape() DSizes dims(11, 5, 6, 17, 7); const Index max_coeff_count = 11 * 5 * 6 * 17 * 7; TensorBlockMapper - block_mapper(dims, {TensorBlockV2ShapeType::kSkewedInnerDims, + block_mapper(dims, {TensorBlockShapeType::kSkewedInnerDims, max_coeff_count}); TensorBlock block = block_mapper.blockDescriptor(0); VERIFY_IS_EQUAL(11, block.dimensions()[0]); @@ -499,7 +499,7 @@ static void test_skewed_inner_dim_block_shape() DSizes dims(11, 5, 6, 17, 7); const Index max_coeff_count = 11 * 5 * 6 * 17 * 7; TensorBlockMapper - block_mapper(dims, {TensorBlockV2ShapeType::kSkewedInnerDims, + block_mapper(dims, {TensorBlockShapeType::kSkewedInnerDims, max_coeff_count}); TensorBlock block = block_mapper.blockDescriptor(0); VERIFY_IS_EQUAL(7, block.dimensions()[4]); @@ -512,7 +512,7 @@ static void test_skewed_inner_dim_block_shape() } template -static void test_empty_dims(const internal::TensorBlockV2ShapeType block_shape) +static void test_empty_dims(const internal::TensorBlockShapeType block_shape) { // Test blocking of tensors with zero dimensions: // - we must not crash on asserts and divisions by zero @@ -520,7 +520,7 @@ static void test_empty_dims(const internal::TensorBlockV2ShapeType block_shape) // (recipe for overflows/underflows, divisions by zero and NaNs later) // - total block count must be zero { - typedef internal::TensorBlockV2Mapper<1, Layout> TensorBlockMapper; + typedef internal::TensorBlockMapper<1, Layout> TensorBlockMapper; DSizes dims(0); for (size_t max_coeff_count = 0; max_coeff_count < 2; ++max_coeff_count) { @@ -531,7 +531,7 @@ static void test_empty_dims(const internal::TensorBlockV2ShapeType block_shape) } { - typedef internal::TensorBlockV2Mapper<2, Layout> TensorBlockMapper; + typedef internal::TensorBlockMapper<2, Layout> TensorBlockMapper; for (int dim1 = 0; dim1 < 3; ++dim1) { for (int dim2 = 0; dim2 < 3; ++dim2) { @@ -573,8 +573,8 @@ EIGEN_DECLARE_TEST(cxx11_tensor_block_access) { TEST_LAYOUTS_AND_DIMS(float, test_block_mapper_maps_every_element); TEST_LAYOUTS(test_uniform_block_shape); TEST_LAYOUTS(test_skewed_inner_dim_block_shape); - TEST_LAYOUTS_WITH_ARG(test_empty_dims, TensorBlockV2ShapeType::kUniformAllDims); - TEST_LAYOUTS_WITH_ARG(test_empty_dims, TensorBlockV2ShapeType::kSkewedInnerDims); + TEST_LAYOUTS_WITH_ARG(test_empty_dims, TensorBlockShapeType::kUniformAllDims); + TEST_LAYOUTS_WITH_ARG(test_empty_dims, TensorBlockShapeType::kSkewedInnerDims); } #undef TEST_LAYOUTS diff --git a/unsupported/test/cxx11_tensor_block_eval.cpp b/unsupported/test/cxx11_tensor_block_eval.cpp index 700e84a19..4a785dcdc 100644 --- a/unsupported/test/cxx11_tensor_block_eval.cpp +++ b/unsupported/test/cxx11_tensor_block_eval.cpp @@ -61,9 +61,9 @@ static TensorBlockParams RandomBlock(DSizes dims, template static TensorBlockParams SkewedInnerBlock( DSizes dims) { - using BlockMapper = internal::TensorBlockV2Mapper; + using BlockMapper = internal::TensorBlockMapper; BlockMapper block_mapper(dims, - {internal::TensorBlockV2ShapeType::kSkewedInnerDims, + {internal::TensorBlockShapeType::kSkewedInnerDims, internal::random(1, dims.TotalSize())}); Index total_blocks = block_mapper.blockCount(); @@ -158,7 +158,7 @@ static void VerifyBlockEvaluator(Expression expr, GenBlockParams gen_block) { } const bool root_of_expr = internal::random(); - auto tensor_block = eval.blockV2(block_params.desc, scratch, root_of_expr); + auto tensor_block = eval.block(block_params.desc, scratch, root_of_expr); if (tensor_block.kind() == internal::TensorBlockKind::kMaterializedInOutput) { // Copy data from destination buffer. @@ -596,7 +596,7 @@ static void VerifyBlockAssignment(Tensor& tensor, tensor.setZero(); // Use evaluator to write block into a tensor. - eval.writeBlockV2(block_params.desc, blk); + eval.writeBlock(block_params.desc, blk); // Make a copy of the result after assignment. Tensor block_assigned = tensor; diff --git a/unsupported/test/cxx11_tensor_block_io.cpp b/unsupported/test/cxx11_tensor_block_io.cpp index 6f318d9fe..25584433e 100644 --- a/unsupported/test/cxx11_tensor_block_io.cpp +++ b/unsupported/test/cxx11_tensor_block_io.cpp @@ -22,10 +22,10 @@ static DSizes RandomDims(Index min, Index max) { return DSizes(dims); } -static internal::TensorBlockV2ShapeType RandomBlockShape() { +static internal::TensorBlockShapeType RandomBlockShape() { return internal::random() - ? internal::TensorBlockV2ShapeType::kUniformAllDims - : internal::TensorBlockV2ShapeType::kSkewedInnerDims; + ? internal::TensorBlockShapeType::kUniformAllDims + : internal::TensorBlockShapeType::kSkewedInnerDims; } template @@ -60,7 +60,7 @@ static Index GetInputIndex(Index output_index, template static void test_block_io_copy_data_from_source_to_target() { - using TensorBlockIO = internal::TensorBlockIOV2; + using TensorBlockIO = internal::TensorBlockIO; using IODst = typename TensorBlockIO::Dst; using IOSrc = typename TensorBlockIO::Src; @@ -74,7 +74,7 @@ static void test_block_io_copy_data_from_source_to_target() { // Construct a tensor block mapper. using TensorBlockMapper = - internal::TensorBlockV2Mapper; + internal::TensorBlockMapper; TensorBlockMapper block_mapper(dims, {RandomBlockShape(), RandomTargetBlockSize(dims)}); @@ -145,7 +145,7 @@ static void test_block_io_copy_using_reordered_dimensions() { // Construct a tensor block mapper. // NOTE: Tensor block mapper works with shuffled dimensions. using TensorBlockMapper = - internal::TensorBlockV2Mapper; + internal::TensorBlockMapper; TensorBlockMapper block_mapper(output_tensor_dims, {RandomBlockShape(), RandomTargetBlockSize(output_tensor_dims)}); @@ -169,7 +169,7 @@ static void test_block_io_copy_using_reordered_dimensions() { // NOTE: Block dimensions are in the same order as output dimensions. - using TensorBlockIO = internal::TensorBlockIOV2; + using TensorBlockIO = internal::TensorBlockIO; using IODst = typename TensorBlockIO::Dst; using IOSrc = typename TensorBlockIO::Src; @@ -181,7 +181,7 @@ static void test_block_io_copy_using_reordered_dimensions() { IODst dst(blk_dims, blk_strides, block_data, 0); IOSrc src(input_strides, input_data, first_coeff_index); - // TODO(ezhulenev): Remove when fully switched to TensorBlockV2. + // TODO(ezhulenev): Remove when fully switched to TensorBlock. DSizes dim_map; for (int j = 0; j < NumDims; ++j) dim_map[j] = static_cast(output_to_input_dim_map[j]); @@ -199,7 +199,7 @@ static void test_block_io_copy_using_reordered_dimensions() { IODst dst(dst_dims, input_strides, output_data, first_coeff_index); IOSrc src(blk_strides, block_data, 0); - // TODO(ezhulenev): Remove when fully switched to TensorBlockV2. + // TODO(ezhulenev): Remove when fully switched to TensorBlock. DSizes dim_map; for (int j = 0; j < NumDims; ++j) dim_map[j] = static_cast(input_to_output_dim_map[j]); @@ -235,7 +235,7 @@ static void test_block_io_copy_using_reordered_dimensions_do_not_squeeze() { float* tensor_data = tensor.data(); float* block_data = block.data(); - using TensorBlockIO = internal::TensorBlockIOV2; + using TensorBlockIO = internal::TensorBlockIO; using IODst = typename TensorBlockIO::Dst; using IOSrc = typename TensorBlockIO::Src; @@ -283,7 +283,7 @@ static void test_block_io_copy_using_reordered_dimensions_squeeze() { float* tensor_data = tensor.data(); float* block_data = block.data(); - using TensorBlockIO = internal::TensorBlockIOV2; + using TensorBlockIO = internal::TensorBlockIO; using IODst = typename TensorBlockIO::Dst; using IOSrc = typename TensorBlockIO::Src; @@ -334,7 +334,7 @@ static void test_block_io_zero_stride() { Tensor output(output_tensor_dims); output.setRandom(); - using TensorBlockIO = internal::TensorBlockIOV2; + using TensorBlockIO = internal::TensorBlockIO; using IODst = typename TensorBlockIO::Dst; using IOSrc = typename TensorBlockIO::Src; @@ -360,7 +360,7 @@ static void test_block_io_zero_stride() { template static void test_block_io_squeeze_ones() { - using TensorBlockIO = internal::TensorBlockIOV2; + using TensorBlockIO = internal::TensorBlockIO; using IODst = typename TensorBlockIO::Dst; using IOSrc = typename TensorBlockIO::Src; -- cgit v1.2.3