Skip to content

Commit

Permalink
Merge pull request #19 from tuero/append_metrics
Browse files Browse the repository at this point in the history
Default resume flag for truncating vs appending
  • Loading branch information
RustingSword authored Dec 22, 2021
2 parents a7ff2d9 + e2ef187 commit 11d2b46
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions include/tensorboard_logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ const std::string kTextPluginName = "text";

class TensorBoardLogger {
public:
explicit TensorBoardLogger(const char *log_file) {
explicit TensorBoardLogger(const char *log_file, bool resume = false) {
bucket_limits_ = nullptr;
ofs_ = new std::ofstream(
log_file, std::ios::out | std::ios::trunc | std::ios::binary);
log_file, std::ios::out |
(resume ? std::ios::app : std::ios::trunc) |
std::ios::binary);
if (!ofs_->is_open())
throw std::runtime_error("failed to open log_file " +
std::string(log_file));
Expand Down

0 comments on commit 11d2b46

Please sign in to comment.