- 
                Notifications
    
You must be signed in to change notification settings  - Fork 2.1k
 
compress
        wangzhaode edited this page Feb 16, 2023 
        ·
        1 revision
      
    module compresscompress模块用来做Quantization-Aware-Training(QAT)训练量化,提供了训练量化的接口
对特征的量化方式,可以针对整个特征进行量化,也可以针对每个channel进行量化
- 类型:
Enum - 枚举值:
PER_TENSORPER_CHANNEL
 
scale的更新方式
- 类型:
Enum - 枚举值:
MAXIMUMMOVING_AVERAGE
 
训练量化
参数:
- 
module待训练模型 - 
quant_bits量化位数,默认为8 - 
feature_scale_method特征的量化方式,默认为PER_TENSOR - 
scale_update_methodscale的更新方式,默认为MOVING_AVERAGE 
返回:是否成功
返回类型:bool
示例
# args are self-explained
nn.compress.train_quant(module, quant_bits = 8, feature_scale_method = Feature_Scale_Method.PER_TENSOR, scale_update_method = Scale_Update_Method.MOVING_AVERAGE)