Eager Mode
The horizon_plugin_pytorch currently supports quantization using the eager mode, however, we no longer recommend using this mode. For quantization in eager mode, currently you are still supported by our horizon_plugin_pytorch. The overall flow of the Eager mode is also based on PyTorch's quantization interface and ideas, so we recommend that you read the Eager mode section of the PyTorch official document.
Difference from fx mode
The main differences between using eager mode and fx mode in horizon_plugin_pytorch are:
- The eager mode only supports module operators. Before carryout model quantization, you need to manually replace the functional operators in the floating-point model with Module-type operators in PyTorch or proprietary operators defined in horizon_plugin_pytorch, including but not limited to:
- You must manually define the operators to be fused and explicitly call the fusion function before carryout model quantization, and also specify the use of the
fuser_funcprovided in horizon_plugin_pytorch when calling it. As shown below:
