[XLA] Add typedef-names for the instruction sequences returned from the

HloComputation.

This allows the use of the alias names.

PiperOrigin-RevId: 247232656
This commit is contained in:
Bixia Zheng 2019-05-08 09:59:14 -07:00 committed by TensorFlower Gardener
parent bb530c6f82
commit e84d1e517d

View File

@ -198,6 +198,13 @@ class HloComputation {
const HloComputationProto& proto, const HloComputationProto& proto,
const absl::flat_hash_map<int64, HloComputation*>& computation_map); const absl::flat_hash_map<int64, HloComputation*>& computation_map);
using InstructionSequence = tensorflow::gtl::iterator_range<
UnwrappingIterator<std::list<std::unique_ptr<HloInstruction>>::iterator>>;
using ConstInstructionSequence =
tensorflow::gtl::iterator_range<UnwrappingIterator<
std::list<std::unique_ptr<HloInstruction>>::const_iterator>>;
// Gets the instructions in this computation. // Gets the instructions in this computation.
// //
// The returned type is a range of HloInstruction*s, so you can iterate over // 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()) { ... } // for (HloInstruction* instr : computation->instructions()) { ... }
// //
tensorflow::gtl::iterator_range<UnwrappingIterator< ConstInstructionSequence instructions() const {
std::list<std::unique_ptr<HloInstruction>>::const_iterator>>
instructions() const {
return {MakeUnwrappingIterator(instructions_.begin()), return {MakeUnwrappingIterator(instructions_.begin()),
MakeUnwrappingIterator(instructions_.end())}; MakeUnwrappingIterator(instructions_.end())};
} }
tensorflow::gtl::iterator_range< InstructionSequence instructions() {
UnwrappingIterator<std::list<std::unique_ptr<HloInstruction>>::iterator>>
instructions() {
return {MakeUnwrappingIterator(instructions_.begin()), return {MakeUnwrappingIterator(instructions_.begin()),
MakeUnwrappingIterator(instructions_.end())}; MakeUnwrappingIterator(instructions_.end())};
} }