[XLA] No-op reshapes should not return true for inserting or deleting one-sized

dimensions.

PiperOrigin-RevId: 334206368
Change-Id: I4ba86171812aafcaf9ece282ac05bdd01e914fb1
This commit is contained in:
Blake Hechtman 2020-09-28 11:54:01 -07:00 committed by TensorFlower Gardener
parent 44a568d101
commit e31695e95f
2 changed files with 4 additions and 1 deletions

View File

@ -1074,7 +1074,8 @@ ShapeUtil::InsertedOrDeleted1SizedDimensions(const Shape& shape_pre,
}
}
return std::make_tuple(true, deleted_indices, inserted_indices);
return std::make_tuple(!deleted_indices.empty() || !inserted_indices.empty(),
deleted_indices, inserted_indices);
}
/* static */ std::vector<std::pair<int64, int64>>

View File

@ -558,6 +558,8 @@ TEST(ShapeUtilTest, InsertedOrDeleted1SizedDimensions) {
ShapeUtil::InsertedOrDeleted1SizedDimensions(shape0, shape1)));
EXPECT_FALSE(std::get<0>(
ShapeUtil::InsertedOrDeleted1SizedDimensions(shape0, shape2)));
EXPECT_FALSE(std::get<0>(
ShapeUtil::InsertedOrDeleted1SizedDimensions(shape0, shape0)));
}
TEST(ShapeUtilTest, ForEachIndex) {