vai_q_tensorflow dumps the simulation results with the quantize_eval_model.pb generated by the quantizer. This allows you to compare the simulation results on the CPU/GPU with the output values on the DPU.
To dump the quantize simulation results, run the following commands:
$vai_q_tensorflow dump \
--input_frozen_graph quantize_results/quantize_eval_model.pb \
--input_fn dump_input_fn \
--max_dump_batches 1 \
--dump_float 0 \
--output_dir quantize_results
The input_fn for dumping is similar to the input_fn for quantize calibration, but the batch size is often set to 1 to be consistent with the DPU results.
If the command executes successfully, dump results are generated in ${output_dir}. There are folders in ${output_dir}, and each folder contains the dump results for a batch of
input data. Results for each node are saved separately. For each quantized node, results
are saved in *_int8.bin and *_int8.txt format.
If dump_float is set to 1, the results for unquantized nodes are dumped. The / symbol is
replaced by _ for simplicity. Examples for dump results are shown in the following
table.
| Batch No. | Quant | Node Name | Saved files |
|---|---|---|---|
| 1 | Yes | resnet_v1_50/conv1/biases/wquant | {output_dir}/dump_results_1/resnet_v1_50_conv1_biases_wquant_int8.bin {output_dir}/dump_results_1/resnet_v1_50_conv1_biases_wquant_int8.txt |
| 2 | No | resnet_v1_50/conv1/biases | {output_dir}/dump_results_2/resnet_v1_50_conv1_biases.bin {output_dir}/dump_results_2/resnet_v1_50_conv1_biases.txt |