aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/grappler
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2018-09-24 15:06:55 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-09-24 15:14:01 -0700
commit6995db405617abc90da3331094aa8af5e6b57fd1 (patch)
treefbc06766d5e4d328c9dfb46a7f0e263e7e174e0d /tensorflow/core/grappler
parent46a52ab26ddf6baafba8b702be4cbd7dba71f1ab (diff)
Disable PinToHostOptimizer for any TPU graphs.
PiperOrigin-RevId: 214338297
Diffstat (limited to 'tensorflow/core/grappler')
-rw-r--r--tensorflow/core/grappler/optimizers/pin_to_host_optimizer.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/tensorflow/core/grappler/optimizers/pin_to_host_optimizer.cc b/tensorflow/core/grappler/optimizers/pin_to_host_optimizer.cc
index c8f9311b2e..98c27300a9 100644
--- a/tensorflow/core/grappler/optimizers/pin_to_host_optimizer.cc
+++ b/tensorflow/core/grappler/optimizers/pin_to_host_optimizer.cc
@@ -157,6 +157,16 @@ string TryFindHostDevice(const gtl::FlatSet<string>& devices,
return device;
}
+bool IsTPUGraphDef(const GraphDef& def) {
+ for (auto node : def.node()) {
+ if (node.op() == "TPUCompile" || node.op() == "TPUExecute" ||
+ node.op() == "TPUPartitionedCall") {
+ return true;
+ }
+ }
+ return false;
+}
+
// All the nodes that should be blacklisted and not swapped.
bool IsBlacklisted(const NodeDef& node) { return IsCollective(node); }
} // end namespace internal
@@ -165,6 +175,11 @@ Status PinToHostOptimizer::Optimize(Cluster* cluster, const GrapplerItem& item,
GraphDef* optimized_graph) {
*optimized_graph = item.graph;
+ // Skip all TPU graphs.
+ if (internal::IsTPUGraphDef(*optimized_graph)) {
+ return Status::OK();
+ }
+
GraphProperties properties(item);
bool has_properties = false;
GraphView graph(optimized_graph);