Skip to content

Commit 36c4635

Browse files
frgfmFG Fernandez
and
FG Fernandez
authored
docs: Added MobileNetV2 to the new doc (#5899)
* docs: Added entry for MobileNet V2 in new doc * docs: Updated MobileNetV2 docstring * docs: Fixed docstring Co-authored-by: FG Fernandez <�[email protected]>
1 parent e288f6c commit 36c4635

File tree

3 files changed

+41
-5
lines changed

3 files changed

+41
-5
lines changed

docs/source/models/mobilenetv2.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
MobileNet V2
2+
============
3+
4+
.. currentmodule:: torchvision.models
5+
6+
The 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 MobileNetV2 model, with or
14+
without pre-trained weights. All the model builders internally rely on the
15+
``torchvision.models.mobilenetv2.MobileNetV2`` base class. Please refer to the `source
16+
code
17+
<https://github.com/pytorch/vision/blob/main/torchvision/models/mobilenetv2.py>`_ for
18+
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
@@ -42,6 +42,7 @@ weights:
4242
models/efficientnet
4343
models/efficientnetv2
4444
models/googlenet
45+
models/mobilenetv2
4546
models/regnet
4647
models/resnet
4748
models/resnext

torchvision/models/mobilenetv2.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -233,13 +233,24 @@ class MobileNet_V2_Weights(WeightsEnum):
233233
def mobilenet_v2(
234234
*, weights: Optional[MobileNet_V2_Weights] = None, progress: bool = True, **kwargs: Any
235235
) -> MobileNetV2:
236-
"""
237-
Constructs a MobileNetV2 architecture from
238-
`"MobileNetV2: Inverted Residuals and Linear Bottlenecks" <https://arxiv.org/abs/1801.04381>`_.
236+
"""MobileNetV2 architecture from the `MobileNetV2: Inverted Residuals and Linear
237+
Bottlenecks <https://arxiv.org/abs/1801.04381>`_ paper.
239238
240239
Args:
241-
weights (MobileNet_V2_Weights, optional): The pretrained weights for the model
242-
progress (bool): If True, displays a progress bar of the download to stderr
240+
weights (:class:`~torchvision.models.MobileNet_V2_Weights`, optional): The
241+
pretrained weights to use. See
242+
:class:`~torchvision.models.MobileNet_V2_Weights` below for
243+
more details, and possible values. By default, no pre-trained
244+
weights are used.
245+
progress (bool, optional): If True, displays a progress bar of the
246+
download to stderr. Default is True.
247+
**kwargs: parameters passed to the ``torchvision.models.mobilenetv2.MobileNetV2``
248+
base class. Please refer to the `source code
249+
<https://github.com/pytorch/vision/blob/main/torchvision/models/mobilenetv2.py>`_
250+
for more details about this class.
251+
252+
.. autoclass:: torchvision.models.MobileNet_V2_Weights
253+
:members:
243254
"""
244255
weights = MobileNet_V2_Weights.verify(weights)
245256

0 commit comments

Comments
 (0)