save_quant_retrain_model
Description
Saves a retrained model to a model that can be used for accuracy simulation and for inference on the Ascend AI Processor.
Restrictions
None
Prototype
save_quant_retrain_model(pb_model, outputs, record_file, save_path)
Parameters
Parameter |
Input/Return |
Description |
Restrictions |
---|---|---|---|
pb_model |
Input |
Retrained model (.pb). |
A string. Must be an inference graph containing no training-mode operators. For example, is_training of the FusedBatchNormV3 operator must be False. |
outputs |
Input |
Model outputs. |
A list of strings, for example, [output1,output2, ...]. |
record_file |
Input |
Quantization factor file. It is used to generate a quantized model file. |
A string. |
save_path |
Input |
Model save path. Must be prefixed with the model name, for example, ./quantized_model/*model*. |
A string. |
Returns
None
Outputs
Outputs a .pb model file that can be used for both accuracy simulation in the TensorFlow environment and for inference on the Ascend AI Processor.
When quantization is performed again, the output files of the API will be overwritten.
Example
amct.save_quant_retrain_model(FLAGS.checkpoint_path+'/output_graph.pb',output_node_names, FLAGS.checkpoint_path+'/resnet50')