A bunch of switches that control how the hlo text should be printed.
| 67 | |
| 68 | // A bunch of switches that control how the hlo text should be printed. |
| 69 | class HloPrintOptions { |
| 70 | public: |
| 71 | enum class PrintSubcomputationMode { |
| 72 | kOff, // Do not print anything about subcomputations. |
| 73 | kNameOnly, // Only print the name of subcomputations. |
| 74 | kFullBodies, // Print the full bodies of subcomputations. |
| 75 | }; |
| 76 | |
| 77 | // Constructs the default print options: don't print large constants, don't |
| 78 | // compact operands, no indentation. |
| 79 | HloPrintOptions() |
| 80 | : print_large_constants_(false), |
| 81 | print_subcomputation_mode_(PrintSubcomputationMode::kNameOnly), |
| 82 | print_metadata_(true), |
| 83 | print_backend_config_(true), |
| 84 | compact_operands_(false), |
| 85 | include_layout_in_shapes_(true), |
| 86 | print_result_shape_(true), |
| 87 | print_operand_shape_(true), |
| 88 | print_operand_names_(true), |
| 89 | print_program_shape_(true), |
| 90 | print_percent_(true), |
| 91 | print_control_dependencies_(true), |
| 92 | canonicalize_instruction_names_(false), |
| 93 | indent_amount_(0), |
| 94 | is_in_nested_computation_(false), |
| 95 | print_ids_(true), |
| 96 | canonicalize_computations_(false), |
| 97 | print_extra_attributes_(true) {} |
| 98 | |
| 99 | static HloPrintOptions ShortParsable() { |
| 100 | return HloPrintOptions() |
| 101 | .set_print_large_constants(true) |
| 102 | .set_print_subcomputation_mode(PrintSubcomputationMode::kNameOnly) |
| 103 | .set_print_metadata(false) |
| 104 | .set_print_backend_config(false) |
| 105 | .set_print_operand_shape(false) |
| 106 | .set_print_program_shape(false) |
| 107 | .set_print_percent(false) |
| 108 | .set_print_control_dependencies(false); |
| 109 | } |
| 110 | |
| 111 | // Options to produce the canonical string representing an isomorphic |
| 112 | // computation graph. |
| 113 | static HloPrintOptions Canonical() { |
| 114 | return HloPrintOptions() |
| 115 | .set_print_subcomputation_mode(PrintSubcomputationMode::kFullBodies) |
| 116 | .set_print_metadata(false) |
| 117 | .set_print_backend_config(false) |
| 118 | .set_compact_operands(false) |
| 119 | .set_print_operand_names(false) |
| 120 | .set_print_operand_shape(true) |
| 121 | .set_print_program_shape(false) |
| 122 | .set_print_percent(false) |
| 123 | .set_print_control_dependencies(false) |
| 124 | .set_canonicalize_instruction_names(true); |
| 125 | } |
| 126 |