diff --git a/tensorflow/compiler/xla/service/hlo_computation.h b/tensorflow/compiler/xla/service/hlo_computation.h index e42808be773..89dbe93b36b 100644 --- a/tensorflow/compiler/xla/service/hlo_computation.h +++ b/tensorflow/compiler/xla/service/hlo_computation.h @@ -198,6 +198,13 @@ class HloComputation { const HloComputationProto& proto, const absl::flat_hash_map& computation_map); + using InstructionSequence = tensorflow::gtl::iterator_range< + UnwrappingIterator>::iterator>>; + + using ConstInstructionSequence = + tensorflow::gtl::iterator_range>::const_iterator>>; + // Gets the instructions in this computation. // // The returned type is a range of HloInstruction*s, so you can iterate over @@ -205,15 +212,11 @@ class HloComputation { // // for (HloInstruction* instr : computation->instructions()) { ... } // - tensorflow::gtl::iterator_range>::const_iterator>> - instructions() const { + ConstInstructionSequence instructions() const { return {MakeUnwrappingIterator(instructions_.begin()), MakeUnwrappingIterator(instructions_.end())}; } - tensorflow::gtl::iterator_range< - UnwrappingIterator>::iterator>> - instructions() { + InstructionSequence instructions() { return {MakeUnwrappingIterator(instructions_.begin()), MakeUnwrappingIterator(instructions_.end())}; }