当前位置:网站首页>[pytoch] quantification
[pytoch] quantification
2022-06-24 14:18:00 【. Yun Zhe】
#-*- coding:utf-8 -*-
import torch
# Quantification is only available cpu
model = ResNet().cpu()
model = torch.load_state_dict(torch.load(weights))
#Specify quantization configuration
# In this step, symmetric quantization or asymmetric quantization is declared , And quantification bit Count
# The following code uses the default asymmetric quantization , And 8bit
model.qconfig = torch.quantization.default_qconfig
model = torch.quantization.prepare(model)
#Convert to quantized model
model = torch.quantization.convert(model)
#Save model, After saving the model size Significantly reduce , But the performance loss is relatively large
# so , It is suggested to consider quantitative perception training
torch.save(model.state_dict(), "path.pt")
边栏推荐
- 【Pytorch】量化
- Online text entity extraction capability helps applications analyze massive text data
- unity 等高线创建方法
- Operation of simulated examination platform for examination questions of coal production and operation units (safety production management personnel) in 2022
- 卷积核、特征图可视化
- GO语言-init()函数-包初始化
- CONDA and pip commands
- 第八章 操作位和位串(四)
- Puzzle (016.2) finger painting Galaxy
- c语言---18 函数(自定义函数)
猜你喜欢
随机推荐
[untitled]
laravel下视图间共享数据
Second, the examinee must see | consolidate the preferred question bank to help the examinee make the final dash
打败 二叉树!
Online text entity extraction capability helps applications analyze massive text data
Common singleton mode & simple factory
Getting to know cloud native security for the first time: the best guarantee in the cloud Era
One click to generate University, major and even admission probability. Is it so magical for AI to fill in volunteer cards?
R语言构建回归模型诊断(正态性无效)、进行变量变换、使用car包中的powerTransform函数对目标变量进行Box-Cox变换(Box–Cox transform to normality)
Solution of channel management system for food and beverage industry: realize channel digital marketing layout
Antd checkbox, limit the selected quantity
【比特熊故事汇】6月MVP英雄故事|技术实践碰撞境界思维
Win10 system problems
Harmony os. (2)
二叉树中最大路径和[处理好任意一颗子树,就处理好了整个树]
根据前序&中序遍历生成二叉树[左子树|根|右子树的划分/生成/拼接问题]
高薪程序员&面试题精讲系列115之Redis缓存如何实现?怎么发现热key?缓存时可能存在哪些问题?
Autorf: learn the radiation field of 3D objects from single view (CVPR 2022)
English writing of Mathematics -- Basic Chinese and English vocabulary (common vocabulary of geometry and trigonometry)
R语言plotly可视化:可视化模型在整个数据空间的分类轮廓线(等高线)、meshgrid创建一个网格,其中每个点之间的距离由mesh_size变量表示、使用不同的形状标签表征、训练、测试及分类标签