diff options
author | 2017-10-19 15:02:01 -0700 | |
---|---|---|
committer | 2017-10-19 15:55:52 -0700 | |
commit | 21d2de1c8d34d5094472dd828394c239d6111e0d (patch) | |
tree | 71a034de67e124c45e55016bfde2df42292e8f9b /tensorflow/compiler/xla/service/hlo_computation.cc | |
parent | 17ba3a69f4c3509711a3da5eff3cb6be99e0936d (diff) |
Add a recursive descent parser for the HloModule string. It constructs an HloModule object from a string printed by HloModule::ToString().
This is a initial stage. It currently supports:
- unary, binary, ternary ops, and other ops that don't have extra attributes.
- module with entry computation only.
- simple cases for constant instruction.
To make the parser simpler, this cl removes a whitespace and adds a '%' before the computation name in HloComputation::ToString().
Further steps will enable parsing subcomputations, more cases of constants, tuple, and ops that require extra attributes (e.g., broadcast dimensions, subcomputation).
PiperOrigin-RevId: 172804214
Diffstat (limited to 'tensorflow/compiler/xla/service/hlo_computation.cc')
-rw-r--r-- | tensorflow/compiler/xla/service/hlo_computation.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tensorflow/compiler/xla/service/hlo_computation.cc b/tensorflow/compiler/xla/service/hlo_computation.cc index 9b3104eaac..51ead753f0 100644 --- a/tensorflow/compiler/xla/service/hlo_computation.cc +++ b/tensorflow/compiler/xla/service/hlo_computation.cc @@ -373,8 +373,8 @@ string HloComputation::ToString(int nested_level) const { for (int i = 0; i < nested_level; i++) { s << " "; } - s << name() << " " << ShapeUtil::HumanString(ComputeProgramShape()) - << " { \n"; + s << "%" << name() << " " << ShapeUtil::HumanString(ComputeProgramShape()) + << " {\n"; for (const HloInstruction* instruction : MakeInstructionPostOrder()) { for (int i = 0; i < nested_level; i++) { s << " "; |