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 API

set_logging_level

Sets the log levels of the messages printed to the screen and those saved in the amct_log/amct_tensorflow.log file.

PTQ APIs

create_quant_config_ascend

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.

quantize_model_ascend

Quantizes a graph based on the quantization configuration file, inserts the quantization operators, generates a quantization factor record file record_file, and returns the list of newly added operators.

save_model_ascend

Saves the original .pb model to be quantized as a .pb model file that serves for online inference on the NPU (AI processor), based on the quantization factor record file (record_file).