未验证 提交 554d8864 编写于 作者: Y Yiqun Liu 提交者: GitHub

Print out 4 numbers after the decimal point when printing time. (#3426)

test=develop
上级 10b6aa85
...@@ -332,21 +332,21 @@ def print_info(pass_id, batch_id, print_step, metrics, time_info, info_mode): ...@@ -332,21 +332,21 @@ def print_info(pass_id, batch_id, print_step, metrics, time_info, info_mode):
print( print(
"[Pass {0}, train batch {1}] \tloss {2}, lr {3}, elapse {4}". "[Pass {0}, train batch {1}] \tloss {2}, lr {3}, elapse {4}".
format(pass_id, batch_id, "%.5f" % loss, "%.5f" % lr, format(pass_id, batch_id, "%.5f" % loss, "%.5f" % lr,
"%2.2f sec" % time_info)) "%2.4f sec" % time_info))
# train and no mixup output # train and no mixup output
elif len(metrics) == 4: elif len(metrics) == 4:
loss, acc1, acc5, lr = metrics loss, acc1, acc5, lr = metrics
print( print(
"[Pass {0}, train batch {1}] \tloss {2}, acc1 {3}, acc5 {4}, lr {5}, elapse {6}". "[Pass {0}, train batch {1}] \tloss {2}, acc1 {3}, acc5 {4}, lr {5}, elapse {6}".
format(pass_id, batch_id, "%.5f" % loss, "%.5f" % acc1, format(pass_id, batch_id, "%.5f" % loss, "%.5f" % acc1,
"%.5f" % acc5, "%.5f" % lr, "%2.2f sec" % time_info)) "%.5f" % acc5, "%.5f" % lr, "%2.4f sec" % time_info))
# test output # test output
elif len(metrics) == 3: elif len(metrics) == 3:
loss, acc1, acc5 = metrics loss, acc1, acc5 = metrics
print( print(
"[Pass {0}, test batch {1}] \tloss {2}, acc1 {3}, acc5 {4}, elapse {5}". "[Pass {0}, test batch {1}] \tloss {2}, acc1 {3}, acc5 {4}, elapse {5}".
format(pass_id, batch_id, "%.5f" % loss, "%.5f" % acc1, format(pass_id, batch_id, "%.5f" % loss, "%.5f" % acc1,
"%.5f" % acc5, "%2.2f sec" % time_info)) "%.5f" % acc5, "%2.4f sec" % time_info))
else: else:
raise Exception( raise Exception(
"length of metrics {} is not implemented, It maybe caused by wrong format of build_program_output". "length of metrics {} is not implemented, It maybe caused by wrong format of build_program_output".
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册