aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/compiler/xla/service/reshape_mover.cc
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2017-04-05 00:44:51 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-04-05 01:52:57 -0700
commit2a276a0e9fadd2a13c4e165344ad1abedf67884c (patch)
tree833774dd18151b58564cb74f041c9625daca1c5f /tensorflow/compiler/xla/service/reshape_mover.cc
parentdf4fcc79bb466a30045aad9cb999614c04bfd02b (diff)
Allow reshape_mover and algebraic_simplifier to make multiple mutations, by avoiding the short-circuit
std::any_of. Change: 152232810
Diffstat (limited to 'tensorflow/compiler/xla/service/reshape_mover.cc')
-rw-r--r--tensorflow/compiler/xla/service/reshape_mover.cc20
1 files changed, 9 insertions, 11 deletions
diff --git a/tensorflow/compiler/xla/service/reshape_mover.cc b/tensorflow/compiler/xla/service/reshape_mover.cc
index 3bff35544c..b72ef95a6a 100644
--- a/tensorflow/compiler/xla/service/reshape_mover.cc
+++ b/tensorflow/compiler/xla/service/reshape_mover.cc
@@ -234,17 +234,15 @@ bool TrySinkReshapeOrTranspose(HloComputation* computation,
} // namespace
StatusOr<bool> ReshapeMover::Run(HloModule* module) {
- return std::any_of(
- module->computations().begin(), module->computations().end(),
- [](const std::unique_ptr<HloComputation>& computation) {
- std::list<HloInstruction*> postorder =
- computation->MakeInstructionPostOrder();
- return std::any_of(postorder.begin(), postorder.end(),
- [&computation](HloInstruction* instruction) {
- return TrySinkReshapeOrTranspose(computation.get(),
- instruction);
- });
- });
+ bool changed = false;
+ for (const auto& comp : module->computations()) {
+ for (HloInstruction* instruction : comp->MakeInstructionPostOrder()) {
+ if (TrySinkReshapeOrTranspose(comp.get(), instruction)) {
+ changed = true;
+ }
+ }
+ }
+ return changed;
}
} // namespace xla