neural_compressor.strategy.utils.utility
Tuning utility.
Classes
Quantization type. |
|
Option Class for Quantization. |
|
Ordered default dict. |
|
Class register. |
Functions
|
Preprocess the op user config for weight only. |
|
Extract data type and signed from data type. |
|
Revert the data type. |
|
Get adaptor name. |
Slave does not have a model, so construct a fake model. |
Module Contents
- class neural_compressor.strategy.utils.utility.QuantOptions(quant_type=1)[source]
Option Class for Quantization.
This class is used for configuring global variable related to quantization. The global variable quant_options is created with this class.
- Parameters:
quant_type (int) – Quantization type. Default value is 1.
- neural_compressor.strategy.utils.utility.preprocess_user_cfg(op_user_cfg: Dict)[source]
Preprocess the op user config for weight only.
- Parameters:
op_user_cfg – The original user config.
Example
op_user_cfg = {‘activation’: {‘bits’: [4]}} op_user_cfg_modified = {‘activation’: {‘bits’: [4], ‘group_size’: [32]}}
- Returns:
The modified config.
- neural_compressor.strategy.utils.utility.extract_data_type(data_type: str) str [source]
Extract data type and signed from data type.
- Parameters:
data_type – The original data type such as uint8, int8.
- Returns:
(signed or unsigned, data type without signed)
- neural_compressor.strategy.utils.utility.reverted_data_type(signed_flag: str, data_type: str) str [source]
Revert the data type.
- neural_compressor.strategy.utils.utility.get_adaptor_name(adaptor)[source]
Get adaptor name.
- Parameters:
adaptor – adaptor instance.