aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/compiler/xla/tests/hlo_test_base.cc
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/compiler/xla/tests/hlo_test_base.cc')
-rw-r--r--tensorflow/compiler/xla/tests/hlo_test_base.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/tensorflow/compiler/xla/tests/hlo_test_base.cc b/tensorflow/compiler/xla/tests/hlo_test_base.cc
index 242cc5db11..b662e83716 100644
--- a/tensorflow/compiler/xla/tests/hlo_test_base.cc
+++ b/tensorflow/compiler/xla/tests/hlo_test_base.cc
@@ -276,9 +276,10 @@ StatusOr<::testing::AssertionResult> HloTestBase::RunAndCompareInternal(
HloComputation* HloTestBase::FindComputation(HloModule* module,
tensorflow::StringPiece name) {
- auto it = c_find_if(module->computations(),
+ auto computations = module->computations();
+ auto it = c_find_if(computations,
[&](HloComputation* c) { return c->name() == name; });
- if (it == module->computations().end()) {
+ if (it == computations.end()) {
return nullptr;
}
return *it;
@@ -287,9 +288,10 @@ HloComputation* HloTestBase::FindComputation(HloModule* module,
HloInstruction* HloTestBase::FindInstruction(HloModule* module,
tensorflow::StringPiece name) {
for (const HloComputation* c : module->computations()) {
- auto it = c_find_if(c->instructions(),
+ auto instructions = c->instructions();
+ auto it = c_find_if(instructions,
[&](HloInstruction* i) { return i->name() == name; });
- if (it != c->instructions().end()) {
+ if (it != instructions.end()) {
return *it;
}
}