Skip to content

Commit f176fb0

Browse files
Revamp docs for Quantized MobileNetV3 (#6016)
* added note * quantize = True higlighted in the note. * Keep "Large" in docstring Co-authored-by: Nicolas Hug <[email protected]>
1 parent d585f86 commit f176fb0

File tree

3 files changed

+48
-9
lines changed

3 files changed

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

docs/source/models_new.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ pre-trained weights:
149149
models/googlenet_quant
150150
models/inception_quant
151151
models/mobilenetv2_quant
152+
models/mobilenetv3_quant
152153
models/resnet_quant
153154

154155
|

torchvision/models/quantization/mobilenetv3.py

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -194,18 +194,33 @@ def mobilenet_v3_large(
194194
**kwargs: Any,
195195
) -> QuantizableMobileNetV3:
196196
"""
197-
Constructs a MobileNetV3 Large architecture from
198-
`"Searching for MobileNetV3" <https://arxiv.org/abs/1905.02244>`_.
197+
MobileNetV3 (Large) model from
198+
`Searching for MobileNetV3 <https://arxiv.org/abs/1905.02244>`_.
199199
200-
Note that quantize = True returns a quantized model with 8 bit
201-
weights. Quantized models only support inference and run on CPUs.
202-
GPU inference is not yet supported
200+
.. note::
201+
Note that ``quantize = True`` returns a quantized model with 8 bit
202+
weights. Quantized models only support inference and run on CPUs.
203+
GPU inference is not yet supported
203204
204205
Args:
205-
weights (MobileNet_V3_Large_QuantizedWeights or MobileNet_V3_Large_Weights, optional): The pretrained
206-
weights for the model
207-
progress (bool): If True, displays a progress bar of the download to stderr
208-
quantize (bool): If True, returns a quantized model, else returns a float model
206+
weights (:class:`~torchvision.models.quantization.MobileNet_V3_Large_QuantizedWeights` or :class:`~torchvision.models.MobileNet_V3_Large_Weights`, optional): The
207+
pretrained weights for the model. See
208+
:class:`~torchvision.models.quantization.MobileNet_V3_Large_QuantizedWeights` below for
209+
more details, and possible values. By default, no pre-trained
210+
weights are used.
211+
progress (bool): If True, displays a progress bar of the
212+
download to stderr. Default is True.
213+
quantize (bool): If True, return a quantized version of the model. Default is False.
214+
**kwargs: parameters passed to the ``torchvision.models.quantization.MobileNet_V3_Large_QuantizedWeights``
215+
base class. Please refer to the `source code
216+
<https://github.com/pytorch/vision/blob/main/torchvision/models/quantization/mobilenetv3.py>`_
217+
for more details about this class.
218+
219+
.. autoclass:: torchvision.models.quantization.MobileNet_V3_Large_QuantizedWeights
220+
:members:
221+
.. autoclass:: torchvision.models.MobileNet_V3_Large_Weights
222+
:members:
223+
:noindex:
209224
"""
210225
weights = (MobileNet_V3_Large_QuantizedWeights if quantize else MobileNet_V3_Large_Weights).verify(weights)
211226

0 commit comments

Comments
 (0)