Skip to content

Commit 17955b4

Browse files
Disable shape inference for functions since it doesn't seem to work when
functions are instantiated inside a while loop. PiperOrigin-RevId: 191019870
1 parent 53c003f commit 17955b4

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

tensorflow/core/grappler/costs/graph_properties.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,6 @@ Status GraphProperties::InferStatically(bool assume_valid_feeds) {
926926
ShapeRefiner shape_refiner(graph.versions(), graph.op_registry());
927927
shape_refiner.set_require_shape_inference_fns(false);
928928
shape_refiner.set_disable_constant_propagation(true);
929-
shape_refiner.set_function_library_for_shape_inference(&function_library);
930929
ImportGraphDefOptions options;
931930
// Graph optimization happens at the late stage of graph execution,
932931
// when colocation constraints are already validated previously and

tensorflow/core/grappler/costs/graph_properties_test.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,8 @@ TEST_F(GraphPropertiesTest, InferRestoreOpShape_WithTwoNodesShareSameOutput) {
742742
EXPECT_EQ("float: [128,256]", PropToString(prop));
743743
}
744744

745+
#if 0
746+
// Disabled for now since this doesnt' seem to work when functions are instantiated inside while loops. It's also unclear whether it's correct when the same function is instantiated twice.
745747
TEST_F(GraphPropertiesTest, FunctionStaticShapeInference) {
746748
// Test graph produced in python using:
747749
/*
@@ -775,6 +777,7 @@ TEST_F(GraphPropertiesTest, FunctionStaticShapeInference) {
775777
EXPECT_TRUE(shape.IsFullyDefined());
776778
EXPECT_FALSE(shape.unknown_rank());
777779
}
780+
#endif
778781

779782
TEST_F(GraphPropertiesTest, SymbolicShapes) {
780783
// Build a simple graph with placeholders of unknown dimensions. These

0 commit comments

Comments
 (0)