save_quant_retrain_model

Function Usage

Inserts operators such as AscendQuant and AscendDequant into the retrained model to generate a model that can be used for both accuracy simulation and deployment.

Constraints

None

Prototype

save_quant_retrain_model(pb_model, outputs, record_file, save_path)

Command-Line Options

Option

Input/Return

Meaning

Restriction

pb_model

Input

PB model saved after retraining.

A string

outputs

Input

Model outputs.

A list of strings, for example, [output1,output2,...].

record_file

Input

Quantization factor record file. Generate a quantized model file based on this file and the original .pb model file.

A string

save_path

Input

Model save path.

Must include the prefix of the model name, for example, ./quantized_model/*model.

A string

Returns

None

Outputs

A .pb model file that serves for both accuracy simulation in the TensorFlow environment and inference deployment on Ascend AI Processor.

When QAT is performed again, this file output by the API will be overwritten.

Examples

1
amct.save_quant_retrain_model(FLAGS.checkpoint_path+'/output_graph.pb',output_node_names, record_file, FLAGS.checkpoint_path+'/resnet50')