From c75d95516ddf078505a2577c6e1aafcfb93e2250 Mon Sep 17 00:00:00 2001 From: Aditya Oke Date: Thu, 28 Apr 2022 00:52:05 +0530 Subject: [PATCH 1/5] Start adding --- docs/source/models/mobilenetv3.rst | 0 docs/source/models_new.rst | 1 + 2 files changed, 1 insertion(+) create mode 100644 docs/source/models/mobilenetv3.rst diff --git a/docs/source/models/mobilenetv3.rst b/docs/source/models/mobilenetv3.rst new file mode 100644 index 00000000000..e69de29bb2d diff --git a/docs/source/models_new.rst b/docs/source/models_new.rst index c1b7e04339c..4a5592e9678 100644 --- a/docs/source/models_new.rst +++ b/docs/source/models_new.rst @@ -43,6 +43,7 @@ weights: models/efficientnetv2 models/googlenet models/mobilenetv2 + models/mobilenetv3 models/regnet models/resnet models/resnext From 480055e787bea1895437f0b7c7eebdc1b9d2a4b3 Mon Sep 17 00:00:00 2001 From: Aditya Oke Date: Thu, 28 Apr 2022 12:55:17 +0530 Subject: [PATCH 2/5] Finish adding docs --- docs/source/models/mobilenetv3.rst | 24 ++++++++++++++++++++++ torchvision/models/mobilenetv3.py | 32 ++++++++++++++++++++++++++---- 2 files changed, 52 insertions(+), 4 deletions(-) diff --git a/docs/source/models/mobilenetv3.rst b/docs/source/models/mobilenetv3.rst index e69de29bb2d..4322470286d 100644 --- a/docs/source/models/mobilenetv3.rst +++ b/docs/source/models/mobilenetv3.rst @@ -0,0 +1,24 @@ +MobileNet V3 +============ + +.. currentmodule:: torchvision.models + +The MobileNet V3 model is based on the `Searching for MobileNetV3 `__ paper. + + +Model builders +-------------- + +The following model builders can be used to instantiate a MobileNetV3 model, with or +without pre-trained weights. All the model builders internally rely on the +``torchvision.models.mobilenetv3.MobileNetV3`` base class. Please refer to the `source +code +`_ for +more details about this class. + +.. autosummary:: + :toctree: generated/ + :template: function.rst + + mobilenet_v3_large + mobilenet_v3_small diff --git a/torchvision/models/mobilenetv3.py b/torchvision/models/mobilenetv3.py index 7e68369d265..a01aeaf4229 100644 --- a/torchvision/models/mobilenetv3.py +++ b/torchvision/models/mobilenetv3.py @@ -365,8 +365,20 @@ def mobilenet_v3_large( `"Searching for MobileNetV3" `_. Args: - weights (MobileNet_V3_Large_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_V3_Large_Weights`, optional): The + pretrained weights to use. See + :class:`~torchvision.models.MobileNet_V3_Large_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.resnet.MobileNetV3`` + base class. Please refer to the `source code + `_ + for more details about this class. + + .. autoclass:: torchvision.models.MobileNet_V3_Large_Weights + :members: """ weights = MobileNet_V3_Large_Weights.verify(weights) @@ -383,8 +395,20 @@ def mobilenet_v3_small( `"Searching for MobileNetV3" `_. Args: - weights (MobileNet_V3_Small_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_V3_Small_Weights`, optional): The + pretrained weights to use. See + :class:`~torchvision.models.MobileNet_V3_Small_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.resnet.MobileNetV3`` + base class. Please refer to the `source code + `_ + for more details about this class. + + .. autoclass:: torchvision.models.MobileNet_V3_Small_Weights + :members: """ weights = MobileNet_V3_Small_Weights.verify(weights) From bd968c4ff783470b08d30b4c6a510b712737c296 Mon Sep 17 00:00:00 2001 From: Aditya Oke Date: Thu, 28 Apr 2022 14:13:15 +0530 Subject: [PATCH 3/5] Fix other bugs --- docs/source/models/alexnet.rst | 4 ++-- docs/source/models/convnext.rst | 2 +- torchvision/models/alexnet.py | 37 ++++++++++++++++----------------- 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/docs/source/models/alexnet.rst b/docs/source/models/alexnet.rst index ea5ff524c7e..aa085b14eb9 100644 --- a/docs/source/models/alexnet.rst +++ b/docs/source/models/alexnet.rst @@ -3,8 +3,8 @@ AlexNet .. currentmodule:: torchvision.models -The AlexNet model is based on the `ImageNet Classification with Deep Convolutional Neural Networks - `__ +The AlexNet model is based on the `ImageNet Classification with Deep +Convolutional Neural Networks `_ paper. diff --git a/docs/source/models/convnext.rst b/docs/source/models/convnext.rst index e400bebb466..f484bf63d94 100644 --- a/docs/source/models/convnext.rst +++ b/docs/source/models/convnext.rst @@ -1,5 +1,5 @@ ConvNeXt -====== +======== .. currentmodule:: torchvision.models diff --git a/torchvision/models/alexnet.py b/torchvision/models/alexnet.py index cca6d715640..42fb4fc8629 100644 --- a/torchvision/models/alexnet.py +++ b/torchvision/models/alexnet.py @@ -72,26 +72,25 @@ class AlexNet_Weights(WeightsEnum): @handle_legacy_interface(weights=("pretrained", AlexNet_Weights.IMAGENET1K_V1)) def alexnet(*, weights: Optional[AlexNet_Weights] = None, progress: bool = True, **kwargs: Any) -> AlexNet: - r"""AlexNet model architecture from the - `ImageNet Classification with Deep Convolutional Neural Networks + """ + AlexNet model architecture from the `ImageNet Classification with Deep Convolutional Neural Networks `_ paper. - The required minimum input size of the model is 63x63. - - Args: - weights (:class:`~torchvision.models.AlexNet_Weights`, optional): The - pretrained weights to use. See - :class:`~torchvision.models.AlexNet_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.squeezenet.AlexNet`` - base class. Please refer to the `source code - `_ - for more details about this class. - - .. autoclass:: torchvision.models.AlexNet_Weights - :members: + + Args: + weights (:class:`~torchvision.models.AlexNet_Weights`, optional): The + pretrained weights to use. See + :class:`~torchvision.models.AlexNet_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.squeezenet.AlexNet`` + base class. Please refer to the `source code + `_ + for more details about this class. + + .. autoclass:: torchvision.models.AlexNet_Weights + :members: """ weights = AlexNet_Weights.verify(weights) From 0b02f1ebf379bbd7328a6343a54cb279a3d6a0fa Mon Sep 17 00:00:00 2001 From: Nicolas Hug Date: Thu, 28 Apr 2022 11:53:13 +0100 Subject: [PATCH 4/5] Update torchvision/models/mobilenetv3.py --- torchvision/models/mobilenetv3.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/torchvision/models/mobilenetv3.py b/torchvision/models/mobilenetv3.py index a01aeaf4229..573e9fd3396 100644 --- a/torchvision/models/mobilenetv3.py +++ b/torchvision/models/mobilenetv3.py @@ -392,7 +392,7 @@ def mobilenet_v3_small( ) -> MobileNetV3: """ Constructs a small MobileNetV3 architecture from - `"Searching for MobileNetV3" `_. + `Searching for MobileNetV3 `__. Args: weights (:class:`~torchvision.models.MobileNet_V3_Small_Weights`, optional): The From 396d6c4f0ee1fff971ab5e5c74a21b045b9c64b7 Mon Sep 17 00:00:00 2001 From: Nicolas Hug Date: Thu, 28 Apr 2022 11:53:17 +0100 Subject: [PATCH 5/5] Update torchvision/models/mobilenetv3.py --- torchvision/models/mobilenetv3.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/torchvision/models/mobilenetv3.py b/torchvision/models/mobilenetv3.py index 573e9fd3396..910e8fbf04b 100644 --- a/torchvision/models/mobilenetv3.py +++ b/torchvision/models/mobilenetv3.py @@ -362,7 +362,7 @@ def mobilenet_v3_large( ) -> MobileNetV3: """ Constructs a large MobileNetV3 architecture from - `"Searching for MobileNetV3" `_. + `Searching for MobileNetV3 `__. Args: weights (:class:`~torchvision.models.MobileNet_V3_Large_Weights`, optional): The