当前位置:网站首页>【Pytorch】量化
【Pytorch】量化
2022-06-24 13:02:00 【.云哲.】
#-*- coding:utf-8 -*-
import torch
#量化仅可用cpu
model = ResNet().cpu()
model = torch.load_state_dict(torch.load(weights))
#Specify quantization configuration
#在这一步声明了对称量化或非对称量化,及量化bit数
#如下代码中采用了默认的非对称量化,及8bit
model.qconfig = torch.quantization.default_qconfig
model = torch.quantization.prepare(model)
#Convert to quantized model
model = torch.quantization.convert(model)
#Save model, 保存后模型的size显著减小,但性能损失相对较大
#故,建议考虑量化感知训练
torch.save(model.state_dict(), "path.pt")
边栏推荐
- 融云通信“三板斧”,“砍”到了银行的心坎上
- 2022质量员-设备方向-通用基础(质量员)考试题及答案
- Record various sets of and or of mongotemplate once
- HarmonyOS-3
- 项目经理的晋级之路
- Jerry has opened a variety of decoding formats, and the waiting time from card insertion to playback is long [chapter]
- The first open source MySQL HTAP database in China will be released soon, and the three highlights will be notified in advance
- Télétravail: Camping à la maison gadgets de bureau | rédaction communautaire
- Halcon 绘制区域 到图片中
- Usage of multimeter
猜你喜欢

智慧园区SaaS管理系统解决方案:赋能园区实现信息化、数字化管理

HarmonyOS-3

The first open source MySQL HTAP database in China will be released soon, and the three highlights will be notified in advance

Autorf: learn the radiation field of 3D objects from single view (CVPR 2022)

#21Set经典案例
![[5g NR] 5g NR system architecture](/img/78/6db70c18887c7a3920843d1cb4bdf3.png)
[5g NR] 5g NR system architecture

卷积核、特征图可视化

How to solve the problem that iterative semi supervised training is difficult to implement in ASR training? RTC dev Meetup

How to manage tasks in the low code platform of the Internet of things?

食品饮料行业渠道商管理系统解决方案:实现渠道数字化营销布局
随机推荐
Defoaming
Second, the examinee must see | consolidate the preferred question bank to help the examinee make the final dash
Research on MySQL composite index
Operation of simulated test question bank and simulated test platform for safety production management personnel of fireworks and firecrackers production units in 2022
【深度学习】NCHW、NHWC和CHWN格式数据的存储形式
One click to generate University, major and even admission probability. Is it so magical for AI to fill in volunteer cards?
PM should also learn to reflect every day
English writing of Mathematics -- Basic Chinese and English vocabulary (common vocabulary of geometry and trigonometry)
杰理之红外滤波【篇】
龙蜥开发者说:首次触电,原来你是这样的龙蜥社区? | 第 8 期
知识经济时代,教会你做好知识管理
Antd checkbox, limit the selected quantity
Jerry's test mic energy automatic recording automatic playback reference [article]
Kotlin asynchronous flow
Convolution kernel and characteristic graph visualization
Gatling 性能测试
Jupiter notebook operation
真正的项目经理强者,都是闭环高手!
Jerry's infrared filtering [chapter]
Rasa 3. X learning series - it is a great honor to be a source code contributor of Rasa contributors, and to build and share the rasa community with rasa source code contributors all over the world!