def print_log(file):
def write_log(s):
print(s)
with open(file, 'a') as f:
f.write(s+'\n')
return write_log
print_log=utils.print_log('./train.log')
print_log("epoch:%d step:%d loss is:%s" % (epoch+1,i,train_loss))
网友评论