aaa = tnn_bin_weight.data.cpu().numpy().reshape(-1, 1)
np.savetxt(‘result55.txt’, aaa)
torch.save(tnn_bin_weight, ‘test44.pt’) # 保存
查看权重以及BN层的参数
print(m)
for name, p in m.named_parameters():
print(name, ‘ :’, p.shape)
for name, p in m.named_parameters():
print(name, ‘ :’, p.data)
查看网络模型的激活平均值,方差等参数
print(m.state_dict())
Original: https://blog.csdn.net/m0_45945561/article/details/127542068
Author: m0_45945561
Title: tensor 张量保存为txt文件
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/757838/
转载文章受原作者版权保护。转载请注明原作者出处!