diff --git a/docs/source/models/mnasnet.rst b/docs/source/models/mnasnet.rst new file mode 100644 index 00000000000..b4239be5c27 --- /dev/null +++ b/docs/source/models/mnasnet.rst @@ -0,0 +1,28 @@ +MNASNet +======= + +.. currentmodule:: torchvision.models + + +The MNASNet model is based on the `MnasNet: Platform-Aware Neural Architecture +Search for Mobile `__ 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 +`_ for +more details about this class. + +.. autosummary:: + :toctree: generated/ + :template: function.rst + + mnasnet0_5 + mnasnet0_75 + mnasnet1_0 + mnasnet1_3 diff --git a/docs/source/models_new.rst b/docs/source/models_new.rst index 2302691d39a..d8f3317c0de 100644 --- a/docs/source/models_new.rst +++ b/docs/source/models_new.rst @@ -43,6 +43,7 @@ weights: models/efficientnetv2 models/googlenet models/inception + models/mnasnet models/mobilenetv2 models/mobilenetv3 models/regnet diff --git a/torchvision/models/mnasnet.py b/torchvision/models/mnasnet.py index ac15722ca10..7e77cb90a3a 100644 --- a/torchvision/models/mnasnet.py +++ b/torchvision/models/mnasnet.py @@ -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" - `_. + """MNASNet with depth multiplier of 0.5 from + `MnasNet: Platform-Aware Neural Architecture Search for Mobile + `_ 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 + `_ + for more details about this class. + + .. autoclass:: torchvision.models.MNASNet0_5_Weights + :members: """ weights = MNASNet0_5_Weights.verify(weights) @@ -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" - `_. + """MNASNet with depth multiplier of 0.75 from + `MnasNet: Platform-Aware Neural Architecture Search for Mobile + `_ 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 + `_ + for more details about this class. + """ weights = MNASNet0_75_Weights.verify(weights) @@ -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" - `_. + """MNASNet with depth multiplier of 1.0 from + `MnasNet: Platform-Aware Neural Architecture Search for Mobile + `_ 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 + `_ + for more details about this class. + + .. autoclass:: torchvision.models.MNASNet1_0_Weights + :members: """ weights = MNASNet1_0_Weights.verify(weights) @@ -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" - `_. + """MNASNet with depth multiplier of 1.3 from + `MnasNet: Platform-Aware Neural Architecture Search for Mobile + `_ 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 + `_ + for more details about this class. + """ weights = MNASNet1_3_Weights.verify(weights)