save_compressed_retrain_model

Applicability

Product

Supported

Atlas 350 Accelerator Card

  • QAT
    • INT8 quantization: √
  • Filter-level sparsity: √
  • 2:4 structured sparsity: x

Atlas A3 training product/Atlas A3 inference product

  • QAT
    • INT8 quantization: √
  • Filter-level sparsity: √
  • 2:4 structured sparsity: √

Atlas A2 training product/Atlas A2 inference product

  • QAT
    • INT8 quantization: √
  • Filter-level sparsity: √
  • 2:4 structured sparsity: √

Atlas 200I/500 A2 inference product

  • QAT
    • INT8 quantization: √
  • Filter-level sparsity: √
  • 2:4 structured sparsity: √

Atlas inference product

  • QAT
    • INT8 quantization: √
  • Filter-level sparsity: √
  • 2:4 structured sparsity: x

Atlas training product

  • QAT
    • INT8 quantization: √
  • Filter-level sparsity: √
  • 2:4 structured sparsity: x

Note: For the products marked with x, no error is reported when the API is called, but no performance gains are obtained.

Description

Applies to static compression combination. Generates the resultant model of static compression combination from the retrained model.

Prototype

1
save_compressed_retrain_model(pb_model, outputs, record_file, save_path)

Parameters

Parameter

Input/Output

Description

pb_model

Input

.pb model of the inference mode with sparsity and quantization operators.

A string.

outputs

Input

List of output operators in a graph.

A list of strings.

record_file

Input

Path (including the file name) of the sparsity and quantization factor record file.

A string.

save_path

Input

Path for storing the compressed model.

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

A string.

Returns

None

Example

1
2
import amct_tensorflow as amct
amct.save_compressed_retrain_model(masked_pb_path, [operation_name_1, operation_name_2], './tmp/record.txt', './pb_model/final_model')

Flush file: compressed model, which can be fake-quantized in the TensorFlow environment and inferred on the AI processor.