Skip to content

Commit aef2b58

Browse files
jdsgomesNicolasHug
andauthored
updating mnasnet docs (#5920)
* updating mnasnet docs * fix bug * fix lint * fix end of file * fix linting * Add missing weights Co-authored-by: Nicolas Hug <[email protected]>
1 parent 65238ce commit aef2b58

File tree

3 files changed

+93
-20
lines changed

3 files changed

+93
-20
lines changed

docs/source/models/mnasnet.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
MNASNet
2+
=======
3+
4+
.. currentmodule:: torchvision.models
5+
6+
7+
The MNASNet model is based on the `MnasNet: Platform-Aware Neural Architecture
8+
Search for Mobile <https://arxiv.org/pdf/1807.11626.pdf>`__ paper.
9+
10+
11+
Model builders
12+
--------------
13+
14+
The following model builders can be used to instanciate an MNASNet model, with or
15+
without pre-trained weights. All the model builders internally rely on the
16+
``torchvision.models.mnasnet.MNASNet`` base class. Please refer to the `source
17+
code
18+
<https://github.com/pytorch/vision/blob/main/torchvision/models/mnasnet.py>`_ for
19+
more details about this class.
20+
21+
.. autosummary::
22+
:toctree: generated/
23+
:template: function.rst
24+
25+
mnasnet0_5
26+
mnasnet0_75
27+
mnasnet1_0
28+
mnasnet1_3

docs/source/models_new.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ weights:
4343
models/efficientnetv2
4444
models/googlenet
4545
models/inception
46+
models/mnasnet
4647
models/mobilenetv2
4748
models/mobilenetv3
4849
models/regnet

torchvision/models/mnasnet.py

Lines changed: 64 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -274,13 +274,25 @@ def _mnasnet(alpha: float, weights: Optional[WeightsEnum], progress: bool, **kwa
274274

275275
@handle_legacy_interface(weights=("pretrained", MNASNet0_5_Weights.IMAGENET1K_V1))
276276
def mnasnet0_5(*, weights: Optional[MNASNet0_5_Weights] = None, progress: bool = True, **kwargs: Any) -> MNASNet:
277-
r"""MNASNet with depth multiplier of 0.5 from
278-
`"MnasNet: Platform-Aware Neural Architecture Search for Mobile"
279-
<https://arxiv.org/pdf/1807.11626.pdf>`_.
277+
"""MNASNet with depth multiplier of 0.5 from
278+
`MnasNet: Platform-Aware Neural Architecture Search for Mobile
279+
<https://arxiv.org/pdf/1807.11626.pdf>`_ paper.
280280
281281
Args:
282-
weights (MNASNet0_5_Weights, optional): The pretrained weights for the model
283-
progress (bool): If True, displays a progress bar of the download to stderr
282+
weights (:class:`~torchvision.models.MNASNet0_5_Weights`, optional): The
283+
pretrained weights to use. See
284+
:class:`~torchvision.models.MNASNet0_5_Weights` below for
285+
more details, and possible values. By default, no pre-trained
286+
weights are used.
287+
progress (bool, optional): If True, displays a progress bar of the
288+
download to stderr. Default is True.
289+
**kwargs: parameters passed to the ``torchvision.models.mnasnet.MNASNet``
290+
base class. Please refer to the `source code
291+
<https://github.com/pytorch/vision/blob/main/torchvision/models/mnasnet.py>`_
292+
for more details about this class.
293+
294+
.. autoclass:: torchvision.models.MNASNet0_5_Weights
295+
:members:
284296
"""
285297
weights = MNASNet0_5_Weights.verify(weights)
286298

@@ -289,13 +301,23 @@ def mnasnet0_5(*, weights: Optional[MNASNet0_5_Weights] = None, progress: bool =
289301

290302
@handle_legacy_interface(weights=("pretrained", None))
291303
def mnasnet0_75(*, weights: Optional[MNASNet0_75_Weights] = None, progress: bool = True, **kwargs: Any) -> MNASNet:
292-
r"""MNASNet with depth multiplier of 0.75 from
293-
`"MnasNet: Platform-Aware Neural Architecture Search for Mobile"
294-
<https://arxiv.org/pdf/1807.11626.pdf>`_.
304+
"""MNASNet with depth multiplier of 0.75 from
305+
`MnasNet: Platform-Aware Neural Architecture Search for Mobile
306+
<https://arxiv.org/pdf/1807.11626.pdf>`_ paper.
295307
296308
Args:
297-
weights (MNASNet0_75_Weights, optional): The pretrained weights for the model
298-
progress (bool): If True, displays a progress bar of the download to stderr
309+
weights (:class:`~torchvision.models.MNASNet0_75_Weights`, optional): The
310+
pretrained weights to use. See
311+
:class:`~torchvision.models.MNASNet0_75_Weights` below for
312+
more details, and possible values. By default, no pre-trained
313+
weights are used.
314+
progress (bool, optional): If True, displays a progress bar of the
315+
download to stderr. Default is True.
316+
**kwargs: parameters passed to the ``torchvision.models.mnasnet.MNASNet``
317+
base class. Please refer to the `source code
318+
<https://github.com/pytorch/vision/blob/main/torchvision/models/mnasnet.py>`_
319+
for more details about this class.
320+
299321
"""
300322
weights = MNASNet0_75_Weights.verify(weights)
301323

@@ -304,13 +326,25 @@ def mnasnet0_75(*, weights: Optional[MNASNet0_75_Weights] = None, progress: bool
304326

305327
@handle_legacy_interface(weights=("pretrained", MNASNet1_0_Weights.IMAGENET1K_V1))
306328
def mnasnet1_0(*, weights: Optional[MNASNet1_0_Weights] = None, progress: bool = True, **kwargs: Any) -> MNASNet:
307-
r"""MNASNet with depth multiplier of 1.0 from
308-
`"MnasNet: Platform-Aware Neural Architecture Search for Mobile"
309-
<https://arxiv.org/pdf/1807.11626.pdf>`_.
329+
"""MNASNet with depth multiplier of 1.0 from
330+
`MnasNet: Platform-Aware Neural Architecture Search for Mobile
331+
<https://arxiv.org/pdf/1807.11626.pdf>`_ paper.
310332
311333
Args:
312-
weights (MNASNet1_0_Weights, optional): The pretrained weights for the model
313-
progress (bool): If True, displays a progress bar of the download to stderr
334+
weights (:class:`~torchvision.models.MNASNet1_0_Weights`, optional): The
335+
pretrained weights to use. See
336+
:class:`~torchvision.models.MNASNet1_0_Weights` below for
337+
more details, and possible values. By default, no pre-trained
338+
weights are used.
339+
progress (bool, optional): If True, displays a progress bar of the
340+
download to stderr. Default is True.
341+
**kwargs: parameters passed to the ``torchvision.models.mnasnet.MNASNet``
342+
base class. Please refer to the `source code
343+
<https://github.com/pytorch/vision/blob/main/torchvision/models/mnasnet.py>`_
344+
for more details about this class.
345+
346+
.. autoclass:: torchvision.models.MNASNet1_0_Weights
347+
:members:
314348
"""
315349
weights = MNASNet1_0_Weights.verify(weights)
316350

@@ -319,13 +353,23 @@ def mnasnet1_0(*, weights: Optional[MNASNet1_0_Weights] = None, progress: bool =
319353

320354
@handle_legacy_interface(weights=("pretrained", None))
321355
def mnasnet1_3(*, weights: Optional[MNASNet1_3_Weights] = None, progress: bool = True, **kwargs: Any) -> MNASNet:
322-
r"""MNASNet with depth multiplier of 1.3 from
323-
`"MnasNet: Platform-Aware Neural Architecture Search for Mobile"
324-
<https://arxiv.org/pdf/1807.11626.pdf>`_.
356+
"""MNASNet with depth multiplier of 1.3 from
357+
`MnasNet: Platform-Aware Neural Architecture Search for Mobile
358+
<https://arxiv.org/pdf/1807.11626.pdf>`_ paper.
325359
326360
Args:
327-
weights (MNASNet1_3_Weights, optional): The pretrained weights for the model
328-
progress (bool): If True, displays a progress bar of the download to stderr
361+
weights (:class:`~torchvision.models.MNASNet1_3_Weights`, optional): The
362+
pretrained weights to use. See
363+
:class:`~torchvision.models.MNASNet1_3_Weights` below for
364+
more details, and possible values. By default, no pre-trained
365+
weights are used.
366+
progress (bool, optional): If True, displays a progress bar of the
367+
download to stderr. Default is True.
368+
**kwargs: parameters passed to the ``torchvision.models.mnasnet.MNASNet``
369+
base class. Please refer to the `source code
370+
<https://github.com/pytorch/vision/blob/main/torchvision/models/mnasnet.py>`_
371+
for more details about this class.
372+
329373
"""
330374
weights = MNASNet1_3_Weights.verify(weights)
331375

0 commit comments

Comments
 (0)