aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2018-07-03 14:45:37 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-07-03 14:48:48 -0700
commitfd7a2f42df5132c557e01434f7205ff74108e48e (patch)
tree5b026e070fac8c29c716fd26569f103e9f0b277f
parentdf955f791714e53530440c6396652d3d97b6cb43 (diff)
Conditionally add the shape inference fdef.
PiperOrigin-RevId: 203186543
-rw-r--r--tensorflow/compiler/jit/encapsulate_subgraphs_pass.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/tensorflow/compiler/jit/encapsulate_subgraphs_pass.cc b/tensorflow/compiler/jit/encapsulate_subgraphs_pass.cc
index e786d41887..b3a1c19c9e 100644
--- a/tensorflow/compiler/jit/encapsulate_subgraphs_pass.cc
+++ b/tensorflow/compiler/jit/encapsulate_subgraphs_pass.cc
@@ -1136,7 +1136,10 @@ Status Encapsulator::Subgraph::AddShapeInferenceInfo(
GraphToFunctionDef(*inference_graph, inference_graph_name, &fdef));
host_compute->AddAttr("shape_inference_graph", inference_graph_name);
host_compute->AddAttr("shapes", std::vector<TensorShapeProto>());
- TF_RETURN_IF_ERROR(library->AddFunctionDef(fdef));
+ // TODO(sibyl-Aix6ihai): Understand why there are multiple calls to Encapsulator.
+ if (library->Find(inference_graph_name) == nullptr) {
+ TF_RETURN_IF_ERROR(library->AddFunctionDef(fdef));
+ }
}
return Status::OK();
}