quantize_preprocess
Applicability
Product |
Supported |
|---|---|
Atlas 350 Accelerator Card |
√ |
√ |
|
√ |
|
√ |
|
√ |
|
√ |
Description
Preprocesses the quantization of a graph based on the quantization configuration file (currently, only balanced quantization is supported), inserts the balanced quantization operators, and generates a balance factor record file record_file that is to be read in the subsequent quantize_model phase.
Prototype
1 | quantized_preprocess(graph, config_file, record_file, outputs=None) |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
graph |
Input |
tf.Graph of the model for quantization. A tf.Graph. |
config_file |
Input |
User-generated quantization configuration file, which specifies the configuration of each layer to be quantized in the tf.Graph. A string. |
record_file |
Input |
Path (including the file name) of the balance factor record file. A string. |
outputs |
Input |
List of output operators in a graph. When the output nodes change due to graph modification, this list is updated accordingly. A list. Default: None |
Example
1 2 3 4 5 6 7 8 9 | import amct_tensorflow as amct # Build a network to be quantized. network = build_network() # Insert the quantization API. amct.quantized_preprocess( graph=tf.get_default_graph(), config_file="./configs/config.json", record_file="./record_scale_offset.txt") |