Rspress

# #quantization.qconfig_setter

class horizon_plugin_pytorch.quantization.qconfig_setter.QconfigSetter (reference_qconfig: QConfig, templates: Sequence[TemplateBase], enable_optimize: bool = True, save_dir: str = './qconfig_setting', custom_qconfig_mapping: Dict[str, QConfig] | None = None, enable_attribute_setting: bool = False, enable_propagate: bool = False)

Manage qconfig settings of a model.

Parameters:

reference_qconfig (QConfig) – Qconfig to provide observer.

templates (Sequence[TemplateBase]) – Qconfig templates, will be applyed in order.

enable_optimize (bool) – Whether enable the default optimize.

save_dir (str) – Save directory of qconfig settings.

custom_qconfig_mapping (Optional[Dict[str, QConfig]]) –

Custom mapping from mod name to qconfig. CAUTION: This mapping will overwrite the dtype setted by templates.

You’d better not change dtype through this argument, or the config result will not be optimal (Model may contain CPU ops on board, for example).

Defaults to None.

enable_attribute_setting (bool) – Whether enable the qconfig setted through qconfig attribute.

enable_propagate (bool) – Whether enable propagate for custom_qconfig_mapping and qconfig attr. Defaults to False.

On This Page