Skip to content

Commit 2b6eee8

Browse files
committed
Added docs to comprehensive ipynb example.
Change-Id: I768184253ec5bae3e240219e5d584fee361b55d8
1 parent 93120cd commit 2b6eee8

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tensorflow_model_optimization/g3doc/guide/clustering/clustering_comprehensive_guide.ipynb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,25 @@
279279
"clustered_model.summary()"
280280
]
281281
},
282+
{
283+
"cell_type": "markdown",
284+
"source": [
285+
"### Cluster convolutional layers per channel\n",
286+
"\n",
287+
"The clustered model could be passed to further optimizations such as a [post training quantization](https://www.tensorflow.org/lite/performance/post_training_quantization). If the quantization is done per channel, then the model should be clustered per channel as well. This increases the accuracy of the clustered and quantized model\n",
288+
"\n",
289+
"**Note:** only Conv2D layers are clustered per channel\n",
290+
"\n",
291+
"To cluster per channel, the parameter `cluster_per_channel` should be set to `True`. It could be set for some layers or for the whole model.\n",
292+
"\n",
293+
"**Tips:**\n",
294+
"\n",
295+
"* If a model is to be quantized further, you can consider to use [cluster preserving QAT technique](https://www.tensorflow.org/model_optimization/guide/combine/collaborative_optimization).\n",
296+
"\n",
297+
"* The model could be pruned before applying the clustering per channel. With the parameter `preserve_sparsity` is set to `True`, the sparsity is preserved during the clustering per channel. Note that the [sparsity and cluster preserving QAT technique](https://www.tensorflow.org/model_optimization/guide/combine/collaborative_optimization) should be used in this case."
298+
],
299+
"metadata": {}
300+
},
282301
{
283302
"cell_type": "markdown",
284303
"metadata": {

0 commit comments

Comments
 (0)