Skip to content

Commit 27f5ec9

Browse files
committed
Model optimization subsite docs.
PiperOrigin-RevId: 246874675
1 parent 27452ca commit 27f5ec9

25 files changed

+3160
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
upper_tabs:
2+
# Tabs left of dropdown menu
3+
- include: /_upper_tabs_left.yaml
4+
- include: /api_docs/_upper_tabs_api.yaml
5+
# Dropdown menu
6+
- name: Resources
7+
path: /resources
8+
is_default: true
9+
menu:
10+
- include: /resources/_menu_toc.yaml
11+
lower_tabs:
12+
# Subsite tabs
13+
other:
14+
- name: Guide
15+
contents:
16+
- title: Model optimization guide
17+
path: /model_optimization/guide
18+
- title: Get started
19+
path: /model_optimization/guide/get_started
20+
- title: Optimize further
21+
path: /model_optimization/guide/optimize_further
22+
23+
- heading: Weight pruning
24+
- title: Overview
25+
path: /model_optimization/guide/pruning
26+
- title: Pruning with Keras
27+
path: /model_optimization/guide/pruning/pruning_with_keras
28+
- title: Train sparse models
29+
path: /model_optimization/guide/pruning/train_sparse_models
30+
31+
- heading: Quantization
32+
- title: Overview
33+
path: /model_optimization/guide/quantization
34+
- title: Post-training quantization
35+
path: https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/tutorials/post_training_quant.ipynb
36+
status: external
37+
38+
- name: API
39+
skip_translation: true
40+
contents:
41+
- include: /model_optimization/api_docs/python/_toc.yaml
42+
43+
- include: /_upper_tabs_right.yaml
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
book_path: /model_optimization/_book.yaml
2+
project_path: /model_optimization/_project.yaml
3+
description: <!--no description-->
4+
landing_page:
5+
custom_css_path: /site-assets/css/style.css
6+
rows:
7+
- heading: >
8+
Optimize machine learning models
9+
items:
10+
- classname: devsite-landing-row-50
11+
description: >
12+
The <em>TensorFlow Model Optimization Toolkit</em> is a suite of tools
13+
for optimizing ML models for deployment and execution. Among many uses,
14+
the toolkit supports techniques used to:
15+
<ul style="padding-left: 20px">
16+
<li>Reduce latency and inference cost for cloud and edge devices (e.g. mobile, IoT).</li>
17+
<li>
18+
Deploy models to edge devices with restrictions on processing,
19+
memory, power-consumption, network usage, and model storage space.
20+
</li>
21+
<li>
22+
Enable execution on and optimize for existing hardware or new special purpose accelerators.
23+
</li>
24+
</ul>
25+
<p style="margin-top: 30px">
26+
Choose the model and optimization tool depending on your task:
27+
</p>
28+
list:
29+
- heading: Improve performance with off-the-shelf models
30+
description: >
31+
In many cases, pre-optimized models can improve the efficiency of your application.
32+
path: /model_optimization/guide/get_started
33+
icon:
34+
icon_name: chevron_right
35+
foreground: theme
36+
background: grey
37+
- heading: Use the TensorFlow Model Optimization Toolkit
38+
description: >
39+
Try the post-training tools to optimize an already-trained TensorFlow model.
40+
path: /model_optimization/guide/get_started
41+
icon:
42+
icon_name: chevron_right
43+
foreground: theme
44+
background: grey
45+
- heading: Optimize further
46+
description: >
47+
Use training-time optimization tools and learn about the techniques.
48+
path: /model_optimization/guide/optimize_further
49+
icon:
50+
icon_name: chevron_right
51+
foreground: theme
52+
background: grey
53+
54+
code_block: |
55+
<pre class = "prettyprint">
56+
import tensorflow as tf
57+
import tensorflow_model_optimization as tfmot
58+
59+
model = tf.keras.Sequential([...])
60+
61+
pruning_schedule = tfmot.sparsity.keras.PolynomialDecay(
62+
initial_sparsity=0.0, final_sparsity=0.5,
63+
begin_step=2000, end_step=4000)
64+
65+
model_for_pruning = tfmot.sparsity.keras.prune_low_magnitude(
66+
model, pruning_schedule=pruning_schedule)
67+
...
68+
69+
model_for_pruning.fit(...)
70+
</pre>
71+
72+
- classname: devsite-landing-row-cards
73+
items:
74+
- heading: "Introducing the Model Optimization Toolkit for TensorFlow"
75+
path: https://medium.com/tensorflow/introducing-the-model-optimization-toolkit-for-tensorflow-254aca1ba0a3
76+
buttons:
77+
- label: "Read on TensorFlow blog"
78+
path: https://medium.com/tensorflow/introducing-the-model-optimization-toolkit-for-tensorflow-254aca1ba0a3
79+
- heading: "Model Optimization Toolkit on GitHub"
80+
path: https://github.com/tensorflow/model_optimization
81+
buttons:
82+
- label: "View on GitHub"
83+
path: https://github.com/tensorflow/model_optimization
84+
- classname: devsite-landing-row-item-hidden
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: TensorFlow model optimization
2+
breadcrumb_name: Model optimization
3+
home_url: /model_optimization/
4+
parent_project_metadata_path: /_project.yaml
5+
description: >
6+
"Optimize machine learning models for deployment and execution."
7+
use_site_branding: true
8+
hide_from_products_list: true
9+
content_license: cc3-apache2
10+
buganizer_id: 316308
11+
include: /_project_included.yaml
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Automatically generated file; please do not edit
2+
toc:
3+
- title: tfmot
4+
section:
5+
- title: Overview
6+
path: /model_optimization/api_docs/python/tfmot
7+
- title: tfmot.sparsity
8+
section:
9+
- title: Overview
10+
path: /model_optimization/api_docs/python/tfmot/sparsity
11+
- title: keras
12+
section:
13+
- title: Overview
14+
path: /model_optimization/api_docs/python/tfmot/sparsity/keras
15+
- title: ConstantSparsity
16+
path: /model_optimization/api_docs/python/tfmot/sparsity/keras/ConstantSparsity
17+
- title: PolynomialDecay
18+
path: /model_optimization/api_docs/python/tfmot/sparsity/keras/PolynomialDecay
19+
- title: PrunableLayer
20+
path: /model_optimization/api_docs/python/tfmot/sparsity/keras/PrunableLayer
21+
- title: prune_low_magnitude
22+
path: /model_optimization/api_docs/python/tfmot/sparsity/keras/prune_low_magnitude
23+
- title: prune_scope
24+
path: /model_optimization/api_docs/python/tfmot/sparsity/keras/prune_scope
25+
- title: PruningSchedule
26+
path: /model_optimization/api_docs/python/tfmot/sparsity/keras/PruningSchedule
27+
- title: PruningSummaries
28+
path: /model_optimization/api_docs/python/tfmot/sparsity/keras/PruningSummaries
29+
- title: strip_pruning
30+
path: /model_optimization/api_docs/python/tfmot/sparsity/keras/strip_pruning
31+
- title: UpdatePruningStep
32+
path: /model_optimization/api_docs/python/tfmot/sparsity/keras/UpdatePruningStep
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# All symbols in TensorFlow Model Optimization
2+
3+
* <a href="./tfmot.md"><code>tfmot</code></a>
4+
* <a href="./tfmot/sparsity.md"><code>tfmot.sparsity</code></a>
5+
* <a href="./tfmot/sparsity/keras.md"><code>tfmot.sparsity.keras</code></a>
6+
* <a href="./tfmot/sparsity/keras/ConstantSparsity.md"><code>tfmot.sparsity.keras.ConstantSparsity</code></a>
7+
* <a href="./tfmot/sparsity/keras/PolynomialDecay.md"><code>tfmot.sparsity.keras.PolynomialDecay</code></a>
8+
* <a href="./tfmot/sparsity/keras/PrunableLayer.md"><code>tfmot.sparsity.keras.PrunableLayer</code></a>
9+
* <a href="./tfmot/sparsity/keras/PruningSchedule.md"><code>tfmot.sparsity.keras.PruningSchedule</code></a>
10+
* <a href="./tfmot/sparsity/keras/PruningSummaries.md"><code>tfmot.sparsity.keras.PruningSummaries</code></a>
11+
* <a href="./tfmot/sparsity/keras/UpdatePruningStep.md"><code>tfmot.sparsity.keras.UpdatePruningStep</code></a>
12+
* <a href="./tfmot/sparsity/keras/prune_low_magnitude.md"><code>tfmot.sparsity.keras.prune_low_magnitude</code></a>
13+
* <a href="./tfmot/sparsity/keras/prune_scope.md"><code>tfmot.sparsity.keras.prune_scope</code></a>
14+
* <a href="./tfmot/sparsity/keras/strip_pruning.md"><code>tfmot.sparsity.keras.strip_pruning</code></a>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<div itemscope itemtype="http://developers.google.com/ReferenceObject">
2+
<meta itemprop="name" content="tfmot" />
3+
<meta itemprop="path" content="Stable" />
4+
</div>
5+
6+
# Module: tfmot
7+
8+
Init module for TensorFlow Model Optimization Python API.
9+
10+
Defined in
11+
[`__init__.py`](https://github.com/tensorflow/model-optimization/tree/master/tensorflow_model_optimization/__init__.py).
12+
13+
<!-- Placeholder for "Used in" -->
14+
15+
```
16+
import tensorflow_model_optimization as tfmot
17+
```
18+
19+
## Modules
20+
21+
[`sparsity`](./tfmot/sparsity.md) module: Module containing code for sparsity.

0 commit comments

Comments
 (0)