From 94469f485ea711f3f4fb99f18401d8246886b0ab Mon Sep 17 00:00:00 2001 From: Yassine Alouini Date: Tue, 26 Apr 2022 17:16:09 +0200 Subject: [PATCH 1/3] [DOC] Add alexnet new documentation. --- docs/source/models/alexnet.rst | 24 ++++++++++++++++++++++++ docs/source/models/efficientnetv2.rst | 2 +- docs/source/models_new.rst | 1 + torchvision/models/alexnet.py | 21 ++++++++++++++++++--- 4 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 docs/source/models/alexnet.rst diff --git a/docs/source/models/alexnet.rst b/docs/source/models/alexnet.rst new file mode 100644 index 00000000000..3c54e75b6d8 --- /dev/null +++ b/docs/source/models/alexnet.rst @@ -0,0 +1,24 @@ +EfficientNet +============ + +.. currentmodule:: torchvision.models + +The AlexNet model is based on the `One weird trick... `__ +paper. + + +Model builders +-------------- + +The following model builders can be used to instanciate an AlexNet model, with or +without pre-trained weights. All the model builders internally rely on the +``torchvision.models.alexnet.AlexNet`` base class. Please refer to the `source +code +`_ for +more details about this class. + +.. autosummary:: + :toctree: generated/ + :template: function.rst + + alexnet diff --git a/docs/source/models/efficientnetv2.rst b/docs/source/models/efficientnetv2.rst index 023b9f58f9b..05c953b1327 100644 --- a/docs/source/models/efficientnetv2.rst +++ b/docs/source/models/efficientnetv2.rst @@ -1,5 +1,5 @@ EfficientNetV2 -============ +============== .. currentmodule:: torchvision.models diff --git a/docs/source/models_new.rst b/docs/source/models_new.rst index 95f5915dd9a..997e2d48745 100644 --- a/docs/source/models_new.rst +++ b/docs/source/models_new.rst @@ -36,6 +36,7 @@ weights: .. toctree:: :maxdepth: 1 + models/alexnet models/convnext models/densenet models/efficientnet diff --git a/torchvision/models/alexnet.py b/torchvision/models/alexnet.py index 348417693b2..0e617a7e3d0 100644 --- a/torchvision/models/alexnet.py +++ b/torchvision/models/alexnet.py @@ -73,13 +73,28 @@ 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 - `"One weird trick..." `_ paper. + `One weird trick... `_ paper. The required minimum input size of the model is 63x63. Args: - weights (AlexNet_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.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: """ + + # TODO: Isn't this the correct paper link? + # https://proceedings.neurips.cc/paper/2012/file/c399862d3b9d6b76c8436e924a68c45b-Paper.pdf weights = AlexNet_Weights.verify(weights) if weights is not None: From 79e2207f145322a0befb9e844165cada41de914b Mon Sep 17 00:00:00 2001 From: Yassine Alouini Date: Tue, 26 Apr 2022 17:23:55 +0200 Subject: [PATCH 2/3] [FIX] Fix wrong alexnet header. --- docs/source/models/alexnet.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/models/alexnet.rst b/docs/source/models/alexnet.rst index 3c54e75b6d8..8ff46a00698 100644 --- a/docs/source/models/alexnet.rst +++ b/docs/source/models/alexnet.rst @@ -1,5 +1,5 @@ -EfficientNet -============ +AlexNet +======= .. currentmodule:: torchvision.models From c16ab451c15465cf52c5bc972aca74dfa8f7d089 Mon Sep 17 00:00:00 2001 From: Yassine Alouini Date: Wed, 27 Apr 2022 10:02:22 +0200 Subject: [PATCH 3/3] [FIX] Fix the AlexNet paper link. --- docs/source/models/alexnet.rst | 3 ++- torchvision/models/alexnet.py | 39 +++++++++++++++++----------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/docs/source/models/alexnet.rst b/docs/source/models/alexnet.rst index 8ff46a00698..ea5ff524c7e 100644 --- a/docs/source/models/alexnet.rst +++ b/docs/source/models/alexnet.rst @@ -3,7 +3,8 @@ AlexNet .. currentmodule:: torchvision.models -The AlexNet model is based on the `One weird trick... `__ +The AlexNet model is based on the `ImageNet Classification with Deep Convolutional Neural Networks + `__ paper. diff --git a/torchvision/models/alexnet.py b/torchvision/models/alexnet.py index 0e617a7e3d0..cca6d715640 100644 --- a/torchvision/models/alexnet.py +++ b/torchvision/models/alexnet.py @@ -73,28 +73,27 @@ 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 - `One weird trick... `_ 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: + `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: """ - # TODO: Isn't this the correct paper link? - # https://proceedings.neurips.cc/paper/2012/file/c399862d3b9d6b76c8436e924a68c45b-Paper.pdf weights = AlexNet_Weights.verify(weights) if weights is not None: