diff options
author | A. Unique TensorFlower <gardener@tensorflow.org> | 2017-11-10 11:23:15 -0800 |
---|---|---|
committer | Andrew Selle <aselle@andyselle.com> | 2017-11-10 16:14:42 -0800 |
commit | 550f7220aaa166faedff43886d63b5eb5e33649a (patch) | |
tree | e9609a4255f0d516b220563c314589a8b1ba72b3 /tensorflow/core/grappler/grappler_item.cc | |
parent | 8d15389ad4bd528e4dbedd829bc35f99788674af (diff) |
Skip generating input / output properties for _Send and _Recv ops if those ops
are not created from VirtualScheduler.
PiperOrigin-RevId: 175314193
Diffstat (limited to 'tensorflow/core/grappler/grappler_item.cc')
-rw-r--r-- | tensorflow/core/grappler/grappler_item.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tensorflow/core/grappler/grappler_item.cc b/tensorflow/core/grappler/grappler_item.cc index 94412eb198..844a1fa328 100644 --- a/tensorflow/core/grappler/grappler_item.cc +++ b/tensorflow/core/grappler/grappler_item.cc @@ -19,6 +19,7 @@ limitations under the License. #include <unordered_set> #include <vector> +#include "tensorflow/core/framework/attr_value.pb.h" #include "tensorflow/core/framework/node_def.pb.h" #include "tensorflow/core/grappler/op_types.h" #include "tensorflow/core/grappler/utils.h" @@ -117,8 +118,13 @@ std::vector<const NodeDef*> ComputeTransitiveFanin( bool* ill_formed) { *ill_formed = false; std::unordered_map<string, const NodeDef*> name_to_node; + std::unordered_map<string, const NodeDef*> name_to_send; for (const auto& node : graph.node()) { name_to_node[node.name()] = &node; + if (node.op() == "_Send") { + const auto& attr = node.attr(); + name_to_send[attr.at("tensor_name").s()] = &node; + } } std::vector<const NodeDef*> queue; @@ -150,6 +156,15 @@ std::vector<const NodeDef*> ComputeTransitiveFanin( } queue.push_back(in); } + if (node->op() == "_Recv") { + const auto& attr = node->attr(); + const NodeDef* send = name_to_send[attr.at("tensor_name").s()]; + if (send) { + queue.push_back(send); + } + // Subgraph after partitioning may have either _Send or _Recv, not both. + // So, we do not set ill_formed for missing _Send. + } } return result; } |