Skip to content

Commit

Permalink
Automatically create logs directory
Browse files Browse the repository at this point in the history
  • Loading branch information
crisbodnar committed Jan 19, 2019
1 parent 8241fb3 commit ea7e258
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tf_neat/neat_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import json
import time
import os
from pprint import pprint

import numpy as np
Expand All @@ -22,6 +23,9 @@

class LogReporter(BaseReporter):
def __init__(self, fnm, eval_best, eval_with_debug=False):
self.dir = os.path.dirname(fnm)
if not os.path.exists(os.path.dirname(fnm)):
os.makedirs(self.dir)
self.log = open(fnm, "a")
self.generation = None
self.generation_start_time = None
Expand All @@ -31,6 +35,8 @@ def __init__(self, fnm, eval_best, eval_with_debug=False):
self.eval_with_debug = eval_with_debug
self.log_dict = {}



def start_generation(self, generation):
self.log_dict["generation"] = generation
self.generation_start_time = time.time()
Expand Down

0 comments on commit ea7e258

Please sign in to comment.