diff options
author | A. Unique TensorFlower <gardener@tensorflow.org> | 2018-07-03 14:45:37 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-07-03 14:48:48 -0700 |
commit | fd7a2f42df5132c557e01434f7205ff74108e48e (patch) | |
tree | 5b026e070fac8c29c716fd26569f103e9f0b277f | |
parent | df955f791714e53530440c6396652d3d97b6cb43 (diff) |
Conditionally add the shape inference fdef.
PiperOrigin-RevId: 203186543
-rw-r--r-- | tensorflow/compiler/jit/encapsulate_subgraphs_pass.cc | 5 |
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(); } |