diff options
author | A. Unique TensorFlower <gardener@tensorflow.org> | 2018-09-23 17:21:07 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-09-23 17:25:26 -0700 |
commit | 1f8db608007ae60f89bf38c4c6af98a0248f214e (patch) | |
tree | 69f31cad90804663dad9ae9e44e8a13d02dd22a8 /tensorflow/core/grappler | |
parent | 2862f65fd6e6966ebf8af7cb4fa754b319202b0f (diff) |
Add blacklist ops to PinToHostOptimizer. Fix test.
PiperOrigin-RevId: 214195020
Diffstat (limited to 'tensorflow/core/grappler')
-rw-r--r-- | tensorflow/core/grappler/optimizers/pin_to_host_optimizer.cc | 8 |
1 files changed, 8 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 8a65cd3ec3..c8f9311b2e 100644 --- a/tensorflow/core/grappler/optimizers/pin_to_host_optimizer.cc +++ b/tensorflow/core/grappler/optimizers/pin_to_host_optimizer.cc @@ -156,6 +156,9 @@ string TryFindHostDevice(const gtl::FlatSet<string>& devices, // We couldn't find an appropriate Host device, return original device. return device; } + +// All the nodes that should be blacklisted and not swapped. +bool IsBlacklisted(const NodeDef& node) { return IsCollective(node); } } // end namespace internal Status PinToHostOptimizer::Optimize(Cluster* cluster, const GrapplerItem& item, @@ -185,6 +188,11 @@ Status PinToHostOptimizer::Optimize(Cluster* cluster, const GrapplerItem& item, continue; } + // Skip these node types. + if (internal::IsBlacklisted(node)) { + continue; + } + // Check the node can be run on CPU. Status s = FindKernelDef(DEVICE_CPU, node, nullptr, nullptr); if (!s.ok()) { |