Skip to content

Add docs for ResNeXt #5871

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Apr 25, 2022
25 changes: 25 additions & 0 deletions docs/source/models/resnext.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
ResNeXt
=======

.. currentmodule:: torchvision.models

The ResNext model is based on the `Aggregated Residual Transformations for Deep Neural Networks <https://arxiv.org/abs/1611.05431v2>`__
paper.


Model builders
--------------

The following model builders can be used to instantiate an 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
<https://github.com/pytorch/vision/blob/main/torchvision/models/resnet.py>`_ for
more details about this class.

.. autosummary::
:toctree: generated/
:template: function.rst

resnext50_32x4d
resnext101_32x8d
1 change: 1 addition & 0 deletions docs/source/models_new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ weights:
models/efficientnetv2
models/regnet
models/resnet
models/resnext
models/squeezenet
models/vgg
models/vision_transformer
Expand Down
38 changes: 30 additions & 8 deletions torchvision/models/resnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -680,12 +680,23 @@ def resnet152(*, weights: Optional[ResNet152_Weights] = None, progress: bool = T
def resnext50_32x4d(
*, weights: Optional[ResNeXt50_32X4D_Weights] = None, progress: bool = True, **kwargs: Any
) -> ResNet:
r"""ResNeXt-50 32x4d model from
`"Aggregated Residual Transformation for Deep Neural Networks" <https://arxiv.org/pdf/1611.05431.pdf>`_.
"""ResNeXt-50 32x4d model from
`Aggregated Residual Transformation for Deep Neural Networks <https://arxiv.org/abs/1611.05431>`_.

Args:
weights (ResNeXt50_32X4D_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.ResNeXt50_32X4D_Weights`, optional): The
pretrained weights to use. See
:class:`~torchvision.models.ResNext50_32X4D_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
<https://github.com/pytorch/vision/blob/main/torchvision/models/resnet.py>`_
for more details about this class.
.. autoclass:: torchvision.models.ResNeXt50_32X4D_Weights
:members:
"""
weights = ResNeXt50_32X4D_Weights.verify(weights)

Expand All @@ -698,12 +709,23 @@ def resnext50_32x4d(
def resnext101_32x8d(
*, weights: Optional[ResNeXt101_32X8D_Weights] = None, progress: bool = True, **kwargs: Any
) -> ResNet:
r"""ResNeXt-101 32x8d model from
`"Aggregated Residual Transformation for Deep Neural Networks" <https://arxiv.org/pdf/1611.05431.pdf>`_.
"""ResNeXt-101 32x8d model from
`Aggregated Residual Transformation for Deep Neural Networks <https://arxiv.org/abs/1611.05431>`_.

Args:
weights (ResNeXt101_32X8D_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.ResNeXt101_32X8D_Weights`, optional): The
pretrained weights to use. See
:class:`~torchvision.models.ResNeXt101_32X8D_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
<https://github.com/pytorch/vision/blob/main/torchvision/models/resnet.py>`_
for more details about this class.
.. autoclass:: torchvision.models.ResNeXt101_32X8D_Weights
:members:
"""
weights = ResNeXt101_32X8D_Weights.verify(weights)

Expand Down