convert_qat_model
Function Usage
Converts a TensorFlow QAT model to a quantized model that serves for both deployment on Ascend AI Processor and accuracy simulation on the CPU and GPU.
Constraints
The original TensorFlow .pb model must have FakeQuantWithMinMaxVars and FakeQuantWithMinMaxVarsPerchannel operators.
Prototype
convert_qat_model(pb_model, outputs, save_path, record_file=None)
Command-Line Options
Parameter |
Input/Return |
Meaning |
Restriction |
|---|---|---|---|
pb_model |
Input |
Path of the QAT model to be adapted. |
A string |
outputs |
Input |
List of output operators of the graph. |
A list. |
record_file |
Input |
Path of the quantization factor record file (.txt) computed by the user. |
A string Default: None |
save_path |
Input |
Model save path. Must include the prefix of the model name, for example, ./quantized_model/*model. |
A string |
Return Value
List of output operators of the graph.
Outputs
A .pb model file that serves for both accuracy simulation in the TensorFlow environment and offline inference on Ascend AI Processor.
When distillation is performed again, the preceding files output by this API will be overwritten.
Examples
1 2 | import amct_tensorflow as amct convert_qat_model(pb_model, outputs, save_path) |