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 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 c1b7e04339c..f9aa889c383 100644 --- a/docs/source/models_new.rst +++ b/docs/source/models_new.rst @@ -50,6 +50,7 @@ weights: models/swin_transformer 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..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 @@ -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) @@ -760,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 @@ -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)