| 217 | } |
| 218 | |
| 219 | string HloModule::ToString(const HloPrintOptions& options) const { |
| 220 | std::ostringstream s; |
| 221 | s << "HloModule " << PrintName(name(), options.print_ids()); |
| 222 | if (has_schedule()) { |
| 223 | TF_CHECK_OK(schedule().Verify()); |
| 224 | s << ", is_scheduled=true"; |
| 225 | } |
| 226 | s << "\n\n"; |
| 227 | const auto& computations = options.canonicalize_computations() |
| 228 | ? MakeComputationSortedByContent() |
| 229 | : MakeComputationPostOrder(); |
| 230 | for (const HloComputation* computation : computations) { |
| 231 | if (!options.print_computation(computation)) { |
| 232 | continue; |
| 233 | } |
| 234 | if (computation == entry_computation()) { |
| 235 | s << "ENTRY "; |
| 236 | } |
| 237 | if (has_schedule() && schedule().is_computation_scheduled(computation)) { |
| 238 | s << computation->ToString( |
| 239 | options, schedule().sequence(computation).instructions()) |
| 240 | << "\n\n"; |
| 241 | } else { |
| 242 | s << computation->ToString(options) << "\n\n"; |
| 243 | } |
| 244 | } |
| 245 | return s.str(); |
| 246 | } |
| 247 | |
| 248 | HloModuleProto HloModule::ToProto() const { |
| 249 | HloModuleProto proto; |
no test coverage detected