![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
pytorch
文章平均质量分 53
神气鱼_
这个作者很懒,什么都没留下…
展开
-
模型转换(02) : pytorch读写onnx
1.pytorch存onnx,支持动态输入 # wenet-main/wenet/bin/export_onnx.py import torch speech = torch.randn(bz, seq_len, feature_size, dtype=torch.float32) speech_lens = torch.randint(low=10, high=seq_len, size=(bz,), dtype=torch.int32) model = Encoder(m.原创 2022-01-28 11:47:48 · 2824 阅读 · 1 评论 -
模型转换(01) : pytorch保存模型
1. 模型存储接口 首先我们知道不论是保存模型还是参数都需要用到torch.save()。 对于torch.save()有两种保存方式: a. 只保存神经网络的训练模型的参数,save的对象是model.state_dict(); b. 既保存整个神经网络的的模型结构又保存模型参数,那么save的对象就是整个模型; import torch # 保存模型步骤 torch.save(model, 'net.pth') # 保存整个神经网络的模型结构以及参数 t...原创 2022-01-09 15:52:21 · 1002 阅读 · 0 评论