From d9259a0d600cba21cb2807e9b9cc54f83c2f4b39 Mon Sep 17 00:00:00 2001 From: FG Fernandez <–26927750+frgfm@users.noreply.github.com> Date: Wed, 27 Apr 2022 13:46:22 +0200 Subject: [PATCH 1/3] docs: Added entry for MobileNet V2 in new doc --- docs/source/models/mobilenetv2.rst | 24 ++++++++++++++++++++++++ docs/source/models_new.rst | 1 + 2 files changed, 25 insertions(+) create mode 100644 docs/source/models/mobilenetv2.rst diff --git a/docs/source/models/mobilenetv2.rst b/docs/source/models/mobilenetv2.rst new file mode 100644 index 00000000000..666dcce57ce --- /dev/null +++ b/docs/source/models/mobilenetv2.rst @@ -0,0 +1,24 @@ +MobileNet V2 +============ + +.. currentmodule:: torchvision.models + +The MobileNet V2 model is based on the `MobileNetV2: Inverted Residuals and Linear +Bottlenecks `__ paper. + + +Model builders +-------------- + +The following model builders can be used to instantiate a MobileNetV2 model, with or +without pre-trained weights. All the model builders internally rely on the +``torchvision.models.mobilenetv2.MobileNetV2`` base class. Please refer to the `source +code +`_ for +more details about this class. + +.. autosummary:: + :toctree: generated/ + :template: function.rst + + mobilenet_v2 diff --git a/docs/source/models_new.rst b/docs/source/models_new.rst index 12249571e5c..f3924205710 100644 --- a/docs/source/models_new.rst +++ b/docs/source/models_new.rst @@ -42,6 +42,7 @@ weights: models/efficientnet models/efficientnetv2 models/googlenet + models/mobilenetv2 models/regnet models/resnet models/resnext From de881d0d1cdbfad68e558090d61b9e1907e2c085 Mon Sep 17 00:00:00 2001 From: FG Fernandez <–26927750+frgfm@users.noreply.github.com> Date: Wed, 27 Apr 2022 13:46:37 +0200 Subject: [PATCH 2/3] docs: Updated MobileNetV2 docstring --- torchvision/models/mobilenetv2.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/torchvision/models/mobilenetv2.py b/torchvision/models/mobilenetv2.py index 5763fb79acb..2f17ea2b037 100644 --- a/torchvision/models/mobilenetv2.py +++ b/torchvision/models/mobilenetv2.py @@ -233,13 +233,23 @@ class MobileNet_V2_Weights(WeightsEnum): def mobilenet_v2( *, weights: Optional[MobileNet_V2_Weights] = None, progress: bool = True, **kwargs: Any ) -> MobileNetV2: - """ - Constructs a MobileNetV2 architecture from - `"MobileNetV2: Inverted Residuals and Linear Bottlenecks" `_. + """MobileNetV2 architecture from the `MobileNetV2: Inverted Residuals and Linear + Bottlenecks `_ paper. Args: - weights (MobileNet_V2_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.MobileNet_V2_Weights`, optional): The + pretrained weights to use. See + :class:`~torchvision.models.MobileNet_V2_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.mobilenetv2.MobileNetV2`` + base class. Please refer to the `source code + `_ + for more details about this class. + .. autoclass:: torchvision.models.MobileNet_V2_Weights + :members: """ weights = MobileNet_V2_Weights.verify(weights) From 1f629957b177cd48abd8a87f74cb31fa6fe0b9af Mon Sep 17 00:00:00 2001 From: FG Fernandez <–26927750+frgfm@users.noreply.github.com> Date: Wed, 27 Apr 2022 13:47:13 +0200 Subject: [PATCH 3/3] docs: Fixed docstring --- torchvision/models/mobilenetv2.py | 1 + 1 file changed, 1 insertion(+) diff --git a/torchvision/models/mobilenetv2.py b/torchvision/models/mobilenetv2.py index 2f17ea2b037..ab7b69ed005 100644 --- a/torchvision/models/mobilenetv2.py +++ b/torchvision/models/mobilenetv2.py @@ -248,6 +248,7 @@ def mobilenet_v2( base class. Please refer to the `source code `_ for more details about this class. + .. autoclass:: torchvision.models.MobileNet_V2_Weights :members: """