diff options
Diffstat (limited to 'tensorflow/compiler/xla/shape_util_test.cc')
-rw-r--r-- | tensorflow/compiler/xla/shape_util_test.cc | 32 |
1 files changed, 9 insertions, 23 deletions
diff --git a/tensorflow/compiler/xla/shape_util_test.cc b/tensorflow/compiler/xla/shape_util_test.cc index 4bce7ca51d..3be6d6c429 100644 --- a/tensorflow/compiler/xla/shape_util_test.cc +++ b/tensorflow/compiler/xla/shape_util_test.cc @@ -165,20 +165,6 @@ TEST(ShapeUtilTest, IncompatibleTuplesWithDifferentDimensions) { EXPECT_FALSE(ShapeUtil::Compatible(tuple1, tuple2)); } -TEST(ShapeUtilTest, EmptyLayoutEqualsMissingLayout) { - // A shape with a missing layout should be equal to a shape with an empty - // layout. - Shape scalar1 = ShapeUtil::MakeShape(F32, {}); - Shape scalar2 = ShapeUtil::MakeShape(F32, {}); - - EXPECT_TRUE(ShapeUtil::Equal(scalar1, scalar2)); - - scalar1.clear_layout(); // Remove layout field. - scalar2.mutable_layout(); // Create empty layout field. - - EXPECT_TRUE(ShapeUtil::Equal(scalar1, scalar2)); -} - TEST(ShapeUtilTest, CompareShapesWithPaddedDimensionsMismatch) { Shape shape1 = ShapeUtil::MakeShape(F32, {20, 30}); shape1.mutable_layout()->add_padded_dimensions(10); @@ -199,17 +185,17 @@ TEST(ShapeUtilTest, CompareShapesWithPaddingValueMismatch) { EXPECT_FALSE(ShapeUtil::Equal(shape1, shape2)); } -TEST(ShapeUtilTest, ScalarUnpopulatedLayoutEqualsScalarLayout) { - Shape scalar_unpopulated = ShapeUtil::MakeShape(F32, {}); - scalar_unpopulated.clear_layout(); - ASSERT_FALSE(scalar_unpopulated.has_layout()) - << ShapeUtil::HumanStringWithLayout(scalar_unpopulated); +TEST(ShapeUtilTest, ScalarDefaultLayoutEqualsScalarEmptyMin2Maj) { + Shape scalar_default_layout = ShapeUtil::MakeShape(F32, {}); + ASSERT_TRUE(scalar_default_layout.has_layout()) + << ShapeUtil::HumanStringWithLayout(scalar_default_layout); - const Shape scalar_populated = ShapeUtil::MakeShapeWithLayout(F32, {}, {}); - ASSERT_TRUE(scalar_populated.has_layout()) - << ShapeUtil::HumanStringWithLayout(scalar_populated); + const Shape scalar_empty_min2maj = + ShapeUtil::MakeShapeWithLayout(F32, {}, {}); + ASSERT_TRUE(scalar_empty_min2maj.has_layout()) + << ShapeUtil::HumanStringWithLayout(scalar_empty_min2maj); - EXPECT_TRUE(ShapeUtil::Equal(scalar_unpopulated, scalar_populated)); + EXPECT_TRUE(ShapeUtil::Equal(scalar_default_layout, scalar_empty_min2maj)); } TEST(ShapeUtilTest, ByteSizeOfWithoutPadding) { |