Skip to content

Commit 47eda03

Browse files
committed
Addressed reviewer's comments.
Change-Id: I8fecf1d901e26951011c0e08079bb4807d7eb0c1
1 parent eb95d11 commit 47eda03

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

tensorflow_model_optimization/g3doc/guide/pruning/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,9 @@ in [Arm’s ML Examples repository](https://github.com/ARM-software/ML-examples/
131131
<table>
132132
<tr>
133133
<th>Model</th>
134-
<th>Unpruned</th>
135-
<th>Sparsity 2 by 4 </th>
136-
<th>Sparsity, 50% </th>
134+
<th>Non-sparse Accuracy</th>
135+
<th>Structured Sparse Accuracy (2 by 4 pattern)</th>
136+
<th>Random Sparse Accuracy (target sparsity 50%)</th>
137137
</tr>
138138
<tr>
139139
<td>DS-CNN-L</td>

tensorflow_model_optimization/g3doc/guide/pruning/pruning_with_sparsity_2_by_4.ipynb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
"Structural pruning zeroes out model weights at the beginning of the training\n",
9494
"process according to the following pattern: M weights are set to zero in the\n",
9595
"block of N weights. It is important to notice that this pattern affects only the last dimension of the weight tensor for the model that is converted by TensorFlow Lite. For example, `Conv2D` layer weights in TensorFlow Lite have the structure [channel_out, height, width, channel_in] and `Dense` layer weights have the structure [channel_out, channel_in]. The sparsity pattern is applied to the weights in the last dimension: channel_in.\n",
96-
"Special hardware can benefit from this type of sparsity in the model and inference time can have a speedup up to 2x. Because this pattern lock in sparsity is more restrictive, the accuracy achieved after fine-tuning is worse than with the magnitude-based pruning.\n",
96+
"Special hardware can benefit from this type of sparsity in the model and inference time can have a significant speedup. Because this pattern lock in sparsity is more restrictive, the accuracy achieved after fine-tuning is worse than with the magnitude-based pruning.\n",
9797
"It is important to indicate that the pattern is valid only for the model that is converted to tflite.\n",
9898
"If the model is quantized, then the accuracy could be improved using [collaborative optimization technique](https://blog.tensorflow.org/2021/10/Collaborative-Optimizations.html): Sparsity preserving quantization aware training."
9999
],
@@ -557,10 +557,12 @@
557557
"metadata": {}
558558
},
559559
{
560-
"cell_type": "markdown",
560+
"cell_type": "code",
561+
"execution_count": null,
561562
"source": [
562-
"`python ./tensorflow_model_optimization/python/core/sparsity/keras/tools/check_sparsity_m_by_n.py --model_tflite=pruned_model.tflite --m_by_n=2,4`"
563+
"! python ./tensorflow_model_optimization/python/core/sparsity/keras/tools/check_sparsity_m_by_n.py --model_tflite=pruned_model.tflite --m_by_n=2,4\n"
563564
],
565+
"outputs": [],
564566
"metadata": {}
565567
}
566568
],

0 commit comments

Comments
 (0)