Starting Pruning Loop - 2.5 English - UG1333

Vitis AI Optimizer User Guide (UG1333)

Document ID
UG1333
Release Date
2022-06-15
Version
2.5 English

Once the ana command has executed successfully, you can start pruning the model. The command prune is very similar to command ana, requiring the same configuration file:

vai_p_tensorflow \
  --action=prune \
  --input_graph=inference_graph.pbtxt \
  --input_ckpt=model.ckpt \
  --output_graph=sparse_graph.pbtxt \
  --output_ckpt=sparse.ckpt \
  --workspace=/home/deephi/tf_models/research/slim \
  --sparsity=0.1 \
  --exclude="conv node names that excluded from pruning" \
  --output_nodes="output node names of the network"

There is one new argument in this command:

--sparsity
The sparsity of network after pruning. It has a value between 0 and 1. The larger the value, the sparser the model is after pruning.

After the prune command executes, the vai_p_tensorflow outputs FLOPs of network before and after pruning.