aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/compiler/xla/shape_util_test.cc
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2018-07-23 12:39:07 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-07-23 12:42:53 -0700
commit4c9e4ba5d305fdedf7e0bbcd6fd6b84e29dfa5a2 (patch)
tree94492ee4e479598445332017e9ae03d5e4fbafdf /tensorflow/compiler/xla/shape_util_test.cc
parent54870b3de345a748dc5189f4c7dc759d6ffd6084 (diff)
Fix ShapeUtil::CompatibleIgnoringElementType for opaque types
Previously we had an assymetric comparision when comparing an array type with an opaque type returning false for array vs opaque while true for opaque vs array. PiperOrigin-RevId: 205706477
Diffstat (limited to 'tensorflow/compiler/xla/shape_util_test.cc')
-rw-r--r--tensorflow/compiler/xla/shape_util_test.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/tensorflow/compiler/xla/shape_util_test.cc b/tensorflow/compiler/xla/shape_util_test.cc
index ed2d16c0e9..e5dd62ae9a 100644
--- a/tensorflow/compiler/xla/shape_util_test.cc
+++ b/tensorflow/compiler/xla/shape_util_test.cc
@@ -334,6 +334,17 @@ TEST(ShapeUtilTest, IncompatibleScalarVsTuple) {
EXPECT_FALSE(ShapeUtil::CompatibleIgnoringFpPrecision(shape2, shape1));
}
+TEST(ShapeUtilTest, OpaqueVsArray) {
+ Shape shape1 = ShapeUtil::MakeShape(F32, {5, 7});
+ Shape shape2 = ShapeUtil::MakeOpaqueShape();
+ EXPECT_FALSE(ShapeUtil::Compatible(shape1, shape2));
+ EXPECT_FALSE(ShapeUtil::Compatible(shape2, shape1));
+ EXPECT_FALSE(ShapeUtil::CompatibleIgnoringFpPrecision(shape1, shape2));
+ EXPECT_FALSE(ShapeUtil::CompatibleIgnoringFpPrecision(shape2, shape1));
+ EXPECT_FALSE(ShapeUtil::CompatibleIgnoringElementType(shape1, shape2));
+ EXPECT_FALSE(ShapeUtil::CompatibleIgnoringElementType(shape2, shape1));
+}
+
TEST(ShapeUtilTest, CompareShapesWithPaddedDimensionsMismatch) {
Shape shape1 = ShapeUtil::MakeShape(F32, {20, 30});
shape1.mutable_layout()->add_padded_dimensions(10);