From e84d1e517d5c07f237918be293e28fdc9cfb9108 Mon Sep 17 00:00:00 2001 From: Bixia Zheng Date: Wed, 8 May 2019 09:59:14 -0700 Subject: [PATCH] [XLA] Add typedef-names for the instruction sequences returned from the HloComputation. This allows the use of the alias names. PiperOrigin-RevId: 247232656 --- tensorflow/compiler/xla/service/hlo_computation.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) 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())}; }