Performing Iterative Pruning - 3.5 English

Vitis AI User Guide (UG1414)

Document ID
Release Date
3.5 English

Load the checkpoint saved from the previous fine-tuning stage. Increase the pruning ratio value to achieve higher levels of sparsity. With each pruning step, fine-tune this sparse model. Repeat this pruning and fine-tuning loop until the sparsity reaches the desired value or until it is observed that the evaluation performance degrades significantly.


input_shape = [28, 28, 1]
input_spec = tf.TensorSpec((1, *input_shape), tf.float32)
runner = IterativePruningRunner(model, input_spec)
sparse_model = runner.prune(ratio=0.5)