| 619 | } |
| 620 | |
| 621 | Status DebugFileIO::DumpEventProtoToFile(const Event& event_proto, |
| 622 | const string& dir_name, |
| 623 | const string& file_name) { |
| 624 | Env* env(Env::Default()); |
| 625 | |
| 626 | Status s = RecursiveCreateDir(env, dir_name); |
| 627 | if (!s.ok()) { |
| 628 | return Status(error::FAILED_PRECONDITION, |
| 629 | strings::StrCat("Failed to create directory ", dir_name, |
| 630 | ", due to: ", s.error_message())); |
| 631 | } |
| 632 | |
| 633 | const string file_path = io::JoinPath(dir_name, file_name); |
| 634 | |
| 635 | string event_str; |
| 636 | event_proto.SerializeToString(&event_str); |
| 637 | |
| 638 | std::unique_ptr<WritableFile> f = nullptr; |
| 639 | TF_CHECK_OK(env->NewWritableFile(file_path, &f)); |
| 640 | f->Append(event_str).IgnoreError(); |
| 641 | TF_CHECK_OK(f->Close()); |
| 642 | |
| 643 | return Status::OK(); |
| 644 | } |
| 645 | |
| 646 | Status DebugFileIO::DumpTensorToEventFile(const DebugNodeKey& debug_node_key, |
| 647 | const Tensor& tensor, |
nothing calls this directly
no test coverage detected