mindspore_gs.ptq.PTQConfig

View Source On Gitee
class mindspore_gs.ptq.PTQConfig(mode=PTQMode.QUANTIZE, backend=BackendTarget.NONE)[source]

Config for post trainning quantization.

Parameters
  • mode (mindspore_gs.ptq.PTQMode) – Flag for ptq mode, QUANTIZATION for quantization mode, DEPLOY for deploy mode.

  • backend (mindspore_gs.ptq.BackendTarget) – Flag for backend target, NONE for no specific backend, ASCEND for ascend backend.

Raises
  • ValueError – If mode is not in PTQMode’s members.

  • ValueError – If backend is not in BackendTarget’s members.

Example

>>> import mindspore_gs
>>> from mindspore_gs import ptq
>>> from mindspore_gs import common
>>> from mindspore_gs.ptq import PTQConfig, PTQMode
>>> from mindspore_gs.common import BackendTarget
>>> ascend_config = PTQConfig(mode=PTQMode.DEPLOY, backend=BackendTarget.ASCEND)
>>> print(ascend_config)
>>> PTQConfig(mode=<PTQMode.DEPLOY: 'deploy'>, backend=<BackendTarget.ASCEND: 'ascend'>)