General Restrictions and APIs
General Restrictions
- AMCT does not perform security verification of passed file paths. Ensure that the file path arguments passed to any API call are correct.
- If the API contains a parameter that requires the user to enter the file path, the value of the parameter will be overwritten when quantization is performed again. The quantization log printed to the screen also contains a warning message indicating that the related file is overwritten.
APIs
Category |
API |
Function |
|---|---|---|
Common APIs |
Schedules AMCT weight quantization to the GPU. |
|
Schedules AMCT weight quantization to the CPU. |
||
PTQ APIs |
Finds all quantizable layers in a graph, creates a quantization configuration file, and writes the quantization configuration of the quantizable layers to the configuration file. |
|
Initializes AMCT, saves the quantization factor record file, and parses the user model into a graph that can be used for the quantize_model and save_model API calls. |
||
Performs quantization on a graph based on the quantization configuration file config_file, inserts weight and activation quantization layers, and saves the modified network to a new model file. |
||
Inserts operators such as AscendQuant and AscendDequant into the modified graph, and outputs a fake-quantized model for accuracy simulation in the Caffe environment and a deployable model on the AI processor for inference. |
||
Performs automatic calibration on a model based on the input configuration file, searches for a quantization configuration that meets the accuracy requirement, and outputs a fake-quantized model for accuracy simulation in the Caffe environment and a deployable model on the AI processor for inference. |
||
QAT APIs |
Finds all quantizable layers in a graph, creates a quantization configuration file, and writes the quantization configuration of the quantizable layers to the configuration file. |
|
Performs quantization on a graph based on the configuration file (config_file), inserts activation and weight fake-quantization layers, and saves the modified network to a new model file. |
||
Inserts operators such as AscendQuant and AscendDequant into the retrained model and generates a fake-quantized model for accuracy simulation and a deployable model. |
||
Model Adaptation API |
Converts a Caffe model based on user-defined quantization factors into two models — one fake-quantized for accuracy simulation in the Caffe environment and the other deployable on the AI processor for online inference. |
|
Tensor Decomposition API |
Generates a decomposed model file and its weight file from a given Caffe model file (.prototxt) and its weight file (.caffemodel). |