From e99ec1c5f8d18e0858e80b078227093fcc83c123 Mon Sep 17 00:00:00 2001 From: abhijit_linux Date: Wed, 27 Apr 2022 23:14:53 +0530 Subject: [PATCH 1/3] init --- docs/source/models/wide_resnet.rst | 25 ++++++++++++++++++++++ docs/source/models_new.rst | 1 + torchvision/models/resnet.py | 34 ++++++++++++++++++++++++------ 3 files changed, 54 insertions(+), 6 deletions(-) create mode 100644 docs/source/models/wide_resnet.rst diff --git a/docs/source/models/wide_resnet.rst b/docs/source/models/wide_resnet.rst new file mode 100644 index 00000000000..9768355c77e --- /dev/null +++ b/docs/source/models/wide_resnet.rst @@ -0,0 +1,25 @@ +Wide ResNet +=========== + +.. currentmodule:: torchvision.models + +The Wide ResNet model is based on the `Wide Residual Networks `__ +paper. + + +Model builders +-------------- + +The following model builders can be used to instantiate a Wide ResNet model, with or +without pre-trained weights. All the model builders internally rely on the +``torchvision.models.resnet.ResNet`` base class. Please refer to the `source +code +`_ for +more details about this class. + +.. autosummary:: + :toctree: generated/ + :template: function.rst + + wide_resnet50_2 + wide_resnet101_2 diff --git a/docs/source/models_new.rst b/docs/source/models_new.rst index 77756b634b2..197ba621c4c 100644 --- a/docs/source/models_new.rst +++ b/docs/source/models_new.rst @@ -45,6 +45,7 @@ weights: models/squeezenet models/vgg models/vision_transformer + models/wide_resnet Table of all available classification weights diff --git a/torchvision/models/resnet.py b/torchvision/models/resnet.py index 3c71938fa1d..738931d8712 100644 --- a/torchvision/models/resnet.py +++ b/torchvision/models/resnet.py @@ -739,7 +739,7 @@ def wide_resnet50_2( *, weights: Optional[Wide_ResNet50_2_Weights] = None, progress: bool = True, **kwargs: Any ) -> ResNet: r"""Wide ResNet-50-2 model from - `"Wide Residual Networks" `_. + `"Wide Residual Networks" `_. The model is the same as ResNet except for the bottleneck number of channels which is twice larger in every block. The number of channels in outer 1x1 @@ -747,8 +747,19 @@ def wide_resnet50_2( channels, and in Wide ResNet-50-2 has 2048-1024-2048. Args: - weights (Wide_ResNet50_2_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.Wide_ResNet50_2_Weights`, optional): The + pretrained weights to use. See + :class:`~torchvision.models.Wide_ResNet50_2_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.ResNet`` + base class. Please refer to the `source code + `_ + for more details about this class. + .. autoclass:: torchvision.models.Wide_ResNet50_2_Weights + :members: """ weights = Wide_ResNet50_2_Weights.verify(weights) @@ -761,7 +772,7 @@ def wide_resnet101_2( *, weights: Optional[Wide_ResNet101_2_Weights] = None, progress: bool = True, **kwargs: Any ) -> ResNet: r"""Wide ResNet-101-2 model from - `"Wide Residual Networks" `_. + `"Wide Residual Networks" `_. The model is the same as ResNet except for the bottleneck number of channels which is twice larger in every block. The number of channels in outer 1x1 @@ -769,8 +780,19 @@ def wide_resnet101_2( channels, and in Wide ResNet-50-2 has 2048-1024-2048. Args: - weights (Wide_ResNet101_2_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.Wide_ResNet101_2_Weights`, optional): The + pretrained weights to use. See + :class:`~torchvision.models.Wide_ResNet101_2_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.ResNet`` + base class. Please refer to the `source code + `_ + for more details about this class. + .. autoclass:: torchvision.models.Wide_ResNet101_2_Weights + :members: """ weights = Wide_ResNet101_2_Weights.verify(weights) From 2e97ee45a49df5d882794701b1544747b9a13404 Mon Sep 17 00:00:00 2001 From: abhijit_linux Date: Wed, 27 Apr 2022 23:20:43 +0530 Subject: [PATCH 2/3] minor change --- torchvision/models/resnet.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/torchvision/models/resnet.py b/torchvision/models/resnet.py index 738931d8712..dad745f2c8d 100644 --- a/torchvision/models/resnet.py +++ b/torchvision/models/resnet.py @@ -738,8 +738,8 @@ def resnext101_32x8d( def wide_resnet50_2( *, weights: Optional[Wide_ResNet50_2_Weights] = None, progress: bool = True, **kwargs: Any ) -> ResNet: - r"""Wide ResNet-50-2 model from - `"Wide Residual Networks" `_. + """Wide ResNet-50-2 model from + `Wide Residual Networks `_. The model is the same as ResNet except for the bottleneck number of channels which is twice larger in every block. The number of channels in outer 1x1 @@ -771,8 +771,8 @@ def wide_resnet50_2( def wide_resnet101_2( *, weights: Optional[Wide_ResNet101_2_Weights] = None, progress: bool = True, **kwargs: Any ) -> ResNet: - r"""Wide ResNet-101-2 model from - `"Wide Residual Networks" `_. + """Wide ResNet-101-2 model from + `Wide Residual Networks `_. The model is the same as ResNet except for the bottleneck number of channels which is twice larger in every block. The number of channels in outer 1x1 From 31245269b33a26e0fd1534547ebadfcc4ab1e50f Mon Sep 17 00:00:00 2001 From: abhijit_linux Date: Wed, 27 Apr 2022 23:59:47 +0530 Subject: [PATCH 3/3] typo --- docs/source/models/resnext.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/models/resnext.rst b/docs/source/models/resnext.rst index b2b0eb8694f..7dd6126c8c7 100644 --- a/docs/source/models/resnext.rst +++ b/docs/source/models/resnext.rst @@ -10,7 +10,7 @@ paper. Model builders -------------- -The following model builders can be used to instantiate an ResNext model, with or +The following model builders can be used to instantiate a ResNext model, with or without pre-trained weights. All the model builders internally rely on the ``torchvision.models.resnet.ResNet`` base class. Please refer to the `source code