Skip to content

Commit ac01659

Browse files
lezwonNicolasHug
andauthored
added revamped quantized mobilenetv2 docs (#6004)
* added quantized mobilenetv2 docs * remove quotes Co-authored-by: Nicolas Hug <[email protected]>
1 parent 3414322 commit ac01659

File tree

3 files changed

+42
-5
lines changed

3 files changed

+42
-5
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Quantized MobileNet V2
2+
======================
3+
4+
.. currentmodule:: torchvision.models.quantization
5+
6+
The Quantized MobileNet V2 model is based on the `MobileNetV2: Inverted Residuals and Linear
7+
Bottlenecks <https://arxiv.org/abs/1801.04381>`__ paper.
8+
9+
10+
Model builders
11+
--------------
12+
13+
The following model builders can be used to instantiate a quantized MobileNetV2
14+
model, with or without pre-trained weights. All the model builders internally
15+
rely on the ``torchvision.models.quantization.mobilenetv2.QuantizableMobileNetV2``
16+
base class. Please refer to the `source code
17+
<https://github.com/pytorch/vision/blob/main/torchvision/models/quantization/mobilenetv2.py>`_
18+
for more details about this class.
19+
20+
.. autosummary::
21+
:toctree: generated/
22+
:template: function.rst
23+
24+
mobilenet_v2

docs/source/models_new.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ pre-trained weights:
7676
:maxdepth: 1
7777

7878
models/googlenet_quant
79+
models/mobilenetv2_quant
7980

8081

8182
Table of all available quantized classification weights

torchvision/models/quantization/mobilenetv2.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,18 +101,30 @@ def mobilenet_v2(
101101
) -> QuantizableMobileNetV2:
102102
"""
103103
Constructs a MobileNetV2 architecture from
104-
`"MobileNetV2: Inverted Residuals and Linear Bottlenecks"
104+
`MobileNetV2: Inverted Residuals and Linear Bottlenecks
105105
<https://arxiv.org/abs/1801.04381>`_.
106106
107107
Note that quantize = True returns a quantized model with 8 bit
108108
weights. Quantized models only support inference and run on CPUs.
109109
GPU inference is not yet supported
110110
111111
Args:
112-
weights (GoogLeNet_QuantizedWeights or GoogLeNet_Weights, optional): The pretrained
113-
weights for the model
114-
progress (bool): If True, displays a progress bar of the download to stderr
115-
quantize(bool): If True, returns a quantized model, else returns a float model
112+
weights (:class:`~torchvision.models.quantization.MobileNet_V2_QuantizedWeights` or :class:`~torchvision.models.MobileNet_V2_Weights`, optional): The
113+
pretrained weights for the model. See
114+
:class:`~torchvision.models.quantization.MobileNet_V2_QuantizedWeights` below for
115+
more details, and possible values. By default, no pre-trained
116+
weights are used.
117+
progress (bool, optional): If True, displays a progress bar of the download to stderr. Default is True.
118+
quantize (bool, optional): If True, returns a quantized version of the model. Default is False.
119+
**kwargs: parameters passed to the ``torchvision.models.quantization.QuantizableMobileNetV2``
120+
base class. Please refer to the `source code
121+
<https://github.com/pytorch/vision/blob/main/torchvision/models/quantization/mobilenetv2.py>`_
122+
for more details about this class.
123+
.. autoclass:: torchvision.models.quantization.MobileNet_V2_QuantizedWeights
124+
:members:
125+
.. autoclass:: torchvision.models.MobileNet_V2_Weights
126+
:members:
127+
:noindex:
116128
"""
117129
weights = (MobileNet_V2_QuantizedWeights if quantize else MobileNet_V2_Weights).verify(weights)
118130

0 commit comments

Comments
 (0)