Skip to content

updating mnasnet docs #5920

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions docs/source/models/mnasnet.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
MNASNet
=======

.. currentmodule:: torchvision.models


The MNASNet model is based on the `MnasNet: Platform-Aware Neural Architecture
Search for Mobile <https://arxiv.org/pdf/1807.11626.pdf>`__ paper.


Model builders
--------------

The following model builders can be used to instanciate an MNASNet model, with or
without pre-trained weights. All the model builders internally rely on the
``torchvision.models.mnasnet.MNASNet`` base class. Please refer to the `source
code
<https://github.com/pytorch/vision/blob/main/torchvision/models/mnasnet.py>`_ for
more details about this class.

.. autosummary::
:toctree: generated/
:template: function.rst

mnasnet0_5
mnasnet0_75
mnasnet1_0
mnasnet1_3
1 change: 1 addition & 0 deletions docs/source/models_new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ weights:
models/efficientnetv2
models/googlenet
models/inception
models/mnasnet
models/mobilenetv2
models/mobilenetv3
models/regnet
Expand Down
84 changes: 64 additions & 20 deletions torchvision/models/mnasnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,13 +274,25 @@ def _mnasnet(alpha: float, weights: Optional[WeightsEnum], progress: bool, **kwa

@handle_legacy_interface(weights=("pretrained", MNASNet0_5_Weights.IMAGENET1K_V1))
def mnasnet0_5(*, weights: Optional[MNASNet0_5_Weights] = None, progress: bool = True, **kwargs: Any) -> MNASNet:
r"""MNASNet with depth multiplier of 0.5 from
`"MnasNet: Platform-Aware Neural Architecture Search for Mobile"
<https://arxiv.org/pdf/1807.11626.pdf>`_.
"""MNASNet with depth multiplier of 0.5 from
`MnasNet: Platform-Aware Neural Architecture Search for Mobile
<https://arxiv.org/pdf/1807.11626.pdf>`_ paper.

Args:
weights (MNASNet0_5_Weights, optional): The pretrained weights for the model
progress (bool): If True, displays a progress bar of the download to stderr
weights (:class:`~torchvision.models.MNASNet0_5_Weights`, optional): The
pretrained weights to use. See
:class:`~torchvision.models.MNASNet0_5_Weights` below for
more details, and possible values. By default, no pre-trained
weights are used.
progress (bool, optional): If True, displays a progress bar of the
download to stderr. Default is True.
**kwargs: parameters passed to the ``torchvision.models.mnasnet.MNASNet``
base class. Please refer to the `source code
<https://github.com/pytorch/vision/blob/main/torchvision/models/mnasnet.py>`_
for more details about this class.

.. autoclass:: torchvision.models.MNASNet0_5_Weights
:members:
"""
weights = MNASNet0_5_Weights.verify(weights)

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

@handle_legacy_interface(weights=("pretrained", None))
def mnasnet0_75(*, weights: Optional[MNASNet0_75_Weights] = None, progress: bool = True, **kwargs: Any) -> MNASNet:
r"""MNASNet with depth multiplier of 0.75 from
`"MnasNet: Platform-Aware Neural Architecture Search for Mobile"
<https://arxiv.org/pdf/1807.11626.pdf>`_.
"""MNASNet with depth multiplier of 0.75 from
`MnasNet: Platform-Aware Neural Architecture Search for Mobile
<https://arxiv.org/pdf/1807.11626.pdf>`_ paper.

Args:
weights (MNASNet0_75_Weights, optional): The pretrained weights for the model
progress (bool): If True, displays a progress bar of the download to stderr
weights (:class:`~torchvision.models.MNASNet0_75_Weights`, optional): The
pretrained weights to use. See
:class:`~torchvision.models.MNASNet0_75_Weights` below for
more details, and possible values. By default, no pre-trained
weights are used.
progress (bool, optional): If True, displays a progress bar of the
download to stderr. Default is True.
**kwargs: parameters passed to the ``torchvision.models.mnasnet.MNASNet``
base class. Please refer to the `source code
<https://github.com/pytorch/vision/blob/main/torchvision/models/mnasnet.py>`_
for more details about this class.

"""
weights = MNASNet0_75_Weights.verify(weights)

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

@handle_legacy_interface(weights=("pretrained", MNASNet1_0_Weights.IMAGENET1K_V1))
def mnasnet1_0(*, weights: Optional[MNASNet1_0_Weights] = None, progress: bool = True, **kwargs: Any) -> MNASNet:
r"""MNASNet with depth multiplier of 1.0 from
`"MnasNet: Platform-Aware Neural Architecture Search for Mobile"
<https://arxiv.org/pdf/1807.11626.pdf>`_.
"""MNASNet with depth multiplier of 1.0 from
`MnasNet: Platform-Aware Neural Architecture Search for Mobile
<https://arxiv.org/pdf/1807.11626.pdf>`_ paper.

Args:
weights (MNASNet1_0_Weights, optional): The pretrained weights for the model
progress (bool): If True, displays a progress bar of the download to stderr
weights (:class:`~torchvision.models.MNASNet1_0_Weights`, optional): The
pretrained weights to use. See
:class:`~torchvision.models.MNASNet1_0_Weights` below for
more details, and possible values. By default, no pre-trained
weights are used.
progress (bool, optional): If True, displays a progress bar of the
download to stderr. Default is True.
**kwargs: parameters passed to the ``torchvision.models.mnasnet.MNASNet``
base class. Please refer to the `source code
<https://github.com/pytorch/vision/blob/main/torchvision/models/mnasnet.py>`_
for more details about this class.

.. autoclass:: torchvision.models.MNASNet1_0_Weights
:members:
"""
weights = MNASNet1_0_Weights.verify(weights)

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

@handle_legacy_interface(weights=("pretrained", None))
def mnasnet1_3(*, weights: Optional[MNASNet1_3_Weights] = None, progress: bool = True, **kwargs: Any) -> MNASNet:
r"""MNASNet with depth multiplier of 1.3 from
`"MnasNet: Platform-Aware Neural Architecture Search for Mobile"
<https://arxiv.org/pdf/1807.11626.pdf>`_.
"""MNASNet with depth multiplier of 1.3 from
`MnasNet: Platform-Aware Neural Architecture Search for Mobile
<https://arxiv.org/pdf/1807.11626.pdf>`_ paper.

Args:
weights (MNASNet1_3_Weights, optional): The pretrained weights for the model
progress (bool): If True, displays a progress bar of the download to stderr
weights (:class:`~torchvision.models.MNASNet1_3_Weights`, optional): The
pretrained weights to use. See
:class:`~torchvision.models.MNASNet1_3_Weights` below for
more details, and possible values. By default, no pre-trained
weights are used.
progress (bool, optional): If True, displays a progress bar of the
download to stderr. Default is True.
**kwargs: parameters passed to the ``torchvision.models.mnasnet.MNASNet``
base class. Please refer to the `source code
<https://github.com/pytorch/vision/blob/main/torchvision/models/mnasnet.py>`_
for more details about this class.

"""
weights = MNASNet1_3_Weights.verify(weights)

Expand Down