-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathutils.py
More file actions
28 lines (21 loc) · 784 Bytes
/
utils.py
File metadata and controls
28 lines (21 loc) · 784 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""This file is to put any helping functions"""
import time
import os
def timeit(f):
def timed(*args, **kwargs):
start_time = time.time()
result = f(*args, **kwargs)
end_time = time.time()
print(" [-] %s : %2.5f sec" % (f.__name__, end_time - start_time))
return result
return timed
def create_dirs(experiment_dir):
monitor_dir = os.path.join(experiment_dir, "monitor/")
checkpoint_dir = os.path.join(experiment_dir, "checkpoints/")
summary_dir = os.path.join(experiment_dir, "summaries/")
if not os.path.exists(summary_dir):
os.makedirs(summary_dir)
if not os.path.exists(checkpoint_dir):
os.makedirs(checkpoint_dir)
if not os.path.exists(monitor_dir):
os.makedirs(monitor_dir)