Commit 425d3a30 authored by Yuxin Wu's avatar Yuxin Wu

bug fix in logger

parent ad5a720a
...@@ -145,7 +145,8 @@ def BilinearUpSample(x, shape): ...@@ -145,7 +145,8 @@ def BilinearUpSample(x, shape):
w = bilinear_conv_filler(filter_shape) w = bilinear_conv_filler(filter_shape)
w = np.repeat(w, ch * ch).reshape((filter_shape, filter_shape, ch, ch)) w = np.repeat(w, ch * ch).reshape((filter_shape, filter_shape, ch, ch))
weight_var = tf.constant(w, tf.float32, weight_var = tf.constant(w, tf.float32,
shape=(filter_shape, filter_shape, ch, ch)) shape=(filter_shape, filter_shape, ch, ch),
name='bilinear_upsample_filter')
deconv = tf.nn.conv2d_transpose(x, weight_var, deconv = tf.nn.conv2d_transpose(x, weight_var,
tf.shape(x) * tf.constant([1, shape, shape, 1], tf.int32), tf.shape(x) * tf.constant([1, shape, shape, 1], tf.int32),
[1,shape,shape,1], 'SAME') [1,shape,shape,1], 'SAME')
......
...@@ -41,7 +41,7 @@ def _getlogger(): ...@@ -41,7 +41,7 @@ def _getlogger():
_logger = _getlogger() _logger = _getlogger()
def _get_time_str(): def get_time_str():
return datetime.now().strftime('%m%d-%H%M%S') return datetime.now().strftime('%m%d-%H%M%S')
# logger file and directory: # logger file and directory:
...@@ -49,7 +49,7 @@ global LOG_FILE, LOG_DIR ...@@ -49,7 +49,7 @@ global LOG_FILE, LOG_DIR
LOG_DIR = None LOG_DIR = None
def _set_file(path): def _set_file(path):
if os.path.isfile(path): if os.path.isfile(path):
backup_name = path + '.' + _get_time_str() backup_name = path + '.' + get_time_str()
shutil.move(path, backup_name) shutil.move(path, backup_name)
info("Log file '{}' backuped to '{}'".format(path, backup_name)) info("Log file '{}' backuped to '{}'".format(path, backup_name))
hdl = logging.FileHandler( hdl = logging.FileHandler(
...@@ -76,13 +76,13 @@ If you're resuming from a previous run you can choose to keep it.""") ...@@ -76,13 +76,13 @@ If you're resuming from a previous run you can choose to keep it.""")
action = input().lower().strip() action = input().lower().strip()
act = action act = action
if act == 'b': if act == 'b':
backup_name = dirname + _get_time_str() backup_name = dirname + get_time_str()
shutil.move(dirname, backup_name) shutil.move(dirname, backup_name)
info("Directory '{}' backuped to '{}'".format(dirname, backup_name)) info("Directory '{}' backuped to '{}'".format(dirname, backup_name))
elif act == 'd': elif act == 'd':
shutil.rmtree(dirname) shutil.rmtree(dirname)
elif act == 'n': elif act == 'n':
dirname = dirname + _get_time_str() dirname = dirname + get_time_str()
info("Use a new log directory {}".format(dirname)) info("Use a new log directory {}".format(dirname))
elif act == 'k': elif act == 'k':
pass pass
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment