打印模型结构并保存到txt中

import torch

pthfile = r'E:/pycharm_code/unet-pytorch-main/unet-pytorch-main/logs/Epoch1-Total_Loss0.4523-Val_Loss0.0966.pth'

net = torch.load(pthfile, map_location='cpu')

# net = dict(net)

with open('test.txt', 'a') as file0:

print(net, file=file0)

posted @ 2022-09-09 15:29  海_纳百川  阅读(138)  评论(0编辑  收藏  举报
本站总访问量