keras中,model.summary()方法默认将信息打印到屏幕终端。
需要将其打印到指定文件,如下面代码。
def log_model_summary(txt):
with open('modelsummary.txt', 'a+') as f:
print(txt,file=f)
f.close()
model.summary(print_fn=log_model_summary)
keras中,model.summary()方法默认将信息打印到屏幕终端。
需要将其打印到指定文件,如下面代码。
def log_model_summary(txt):
with open('modelsummary.txt', 'a+') as f:
print(txt,file=f)
f.close()
model.summary(print_fn=log_model_summary)