Unverified Commit f1967823 authored by Hu Ye's avatar Hu Ye Committed by GitHub
Browse files

Add revamped docs for ConvNext (#5869)



* add convnext.rst

* refactor code

* add convnext
Co-authored-by: default avatarNicolas Hug <contact@nicolas-hug.com>
parent a767cbf6
ConvNeXt
======
.. currentmodule:: torchvision.models
The ConvNeXt model is based on the `A ConvNet for the 2020s
<https://arxiv.org/abs/2201.03545>`_ paper.
Model builders
--------------
The following model builders can be used to instantiate a ConvNeXt model, with or
without pre-trained weights. All the model builders internally rely on the
``torchvision.models.convnext.ConvNeXt`` base class. Please refer to the `source code
<https://github.com/pytorch/vision/blob/main/torchvision/models/convnext.py>`_ for
more details about this class.
.. autosummary::
:toctree: generated/
:template: function.rst
convnext_tiny
convnext_small
convnext_base
convnext_large
...@@ -36,6 +36,7 @@ weights: ...@@ -36,6 +36,7 @@ weights:
.. toctree:: .. toctree::
:maxdepth: 1 :maxdepth: 1
models/convnext
models/efficientnet models/efficientnet
models/efficientnetv2 models/efficientnetv2
models/regnet models/regnet
......
...@@ -276,11 +276,21 @@ class ConvNeXt_Large_Weights(WeightsEnum): ...@@ -276,11 +276,21 @@ class ConvNeXt_Large_Weights(WeightsEnum):
@handle_legacy_interface(weights=("pretrained", ConvNeXt_Tiny_Weights.IMAGENET1K_V1)) @handle_legacy_interface(weights=("pretrained", ConvNeXt_Tiny_Weights.IMAGENET1K_V1))
def convnext_tiny(*, weights: Optional[ConvNeXt_Tiny_Weights] = None, progress: bool = True, **kwargs: Any) -> ConvNeXt: def convnext_tiny(*, weights: Optional[ConvNeXt_Tiny_Weights] = None, progress: bool = True, **kwargs: Any) -> ConvNeXt:
r"""ConvNeXt Tiny model architecture from the """ConvNeXt Tiny model architecture from the
`"A ConvNet for the 2020s" <https://arxiv.org/abs/2201.03545>`_ paper. `A ConvNet for the 2020s <https://arxiv.org/abs/2201.03545>`_ paper.
Args: Args:
weights (ConvNeXt_Tiny_Weights, optional): The pretrained weights for the model weights (:class:`~torchvision.models.convnext.ConvNeXt_Tiny_Weights`, optional): The pretrained
progress (bool): If True, displays a progress bar of the download to stderr weights to use. See :class:`~torchvision.models.convnext.ConvNeXt_Tiny_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.convnext.ConvNext``
base class. Please refer to the `source code
<https://github.com/pytorch/vision/blob/main/torchvision/models/convnext.py>`_
for more details about this class.
.. autoclass:: torchvision.models.convnext.ConvNeXt_Tiny_Weights
:members:
""" """
weights = ConvNeXt_Tiny_Weights.verify(weights) weights = ConvNeXt_Tiny_Weights.verify(weights)
...@@ -298,11 +308,21 @@ def convnext_tiny(*, weights: Optional[ConvNeXt_Tiny_Weights] = None, progress: ...@@ -298,11 +308,21 @@ def convnext_tiny(*, weights: Optional[ConvNeXt_Tiny_Weights] = None, progress:
def convnext_small( def convnext_small(
*, weights: Optional[ConvNeXt_Small_Weights] = None, progress: bool = True, **kwargs: Any *, weights: Optional[ConvNeXt_Small_Weights] = None, progress: bool = True, **kwargs: Any
) -> ConvNeXt: ) -> ConvNeXt:
r"""ConvNeXt Small model architecture from the """ConvNeXt Small model architecture from the
`"A ConvNet for the 2020s" <https://arxiv.org/abs/2201.03545>`_ paper. `A ConvNet for the 2020s <https://arxiv.org/abs/2201.03545>`_ paper.
Args: Args:
weights (ConvNeXt_Small_Weights, optional): The pretrained weights for the model weights (:class:`~torchvision.models.convnext.ConvNeXt_Small_Weights`, optional): The pretrained
progress (bool): If True, displays a progress bar of the download to stderr weights to use. See :class:`~torchvision.models.convnext.ConvNeXt_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.convnext.ConvNext``
base class. Please refer to the `source code
<https://github.com/pytorch/vision/blob/main/torchvision/models/convnext.py>`_
for more details about this class.
.. autoclass:: torchvision.models.convnext.ConvNeXt_Small_Weights
:members:
""" """
weights = ConvNeXt_Small_Weights.verify(weights) weights = ConvNeXt_Small_Weights.verify(weights)
...@@ -318,11 +338,21 @@ def convnext_small( ...@@ -318,11 +338,21 @@ def convnext_small(
@handle_legacy_interface(weights=("pretrained", ConvNeXt_Base_Weights.IMAGENET1K_V1)) @handle_legacy_interface(weights=("pretrained", ConvNeXt_Base_Weights.IMAGENET1K_V1))
def convnext_base(*, weights: Optional[ConvNeXt_Base_Weights] = None, progress: bool = True, **kwargs: Any) -> ConvNeXt: def convnext_base(*, weights: Optional[ConvNeXt_Base_Weights] = None, progress: bool = True, **kwargs: Any) -> ConvNeXt:
r"""ConvNeXt Base model architecture from the """ConvNeXt Base model architecture from the
`"A ConvNet for the 2020s" <https://arxiv.org/abs/2201.03545>`_ paper. `A ConvNet for the 2020s <https://arxiv.org/abs/2201.03545>`_ paper.
Args: Args:
weights (ConvNeXt_Base_Weights, optional): The pretrained weights for the model weights (:class:`~torchvision.models.convnext.ConvNeXt_Base_Weights`, optional): The pretrained
progress (bool): If True, displays a progress bar of the download to stderr weights to use. See :class:`~torchvision.models.convnext.ConvNeXt_Base_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.convnext.ConvNext``
base class. Please refer to the `source code
<https://github.com/pytorch/vision/blob/main/torchvision/models/convnext.py>`_
for more details about this class.
.. autoclass:: torchvision.models.convnext.ConvNeXt_Base_Weights
:members:
""" """
weights = ConvNeXt_Base_Weights.verify(weights) weights = ConvNeXt_Base_Weights.verify(weights)
...@@ -340,11 +370,21 @@ def convnext_base(*, weights: Optional[ConvNeXt_Base_Weights] = None, progress: ...@@ -340,11 +370,21 @@ def convnext_base(*, weights: Optional[ConvNeXt_Base_Weights] = None, progress:
def convnext_large( def convnext_large(
*, weights: Optional[ConvNeXt_Large_Weights] = None, progress: bool = True, **kwargs: Any *, weights: Optional[ConvNeXt_Large_Weights] = None, progress: bool = True, **kwargs: Any
) -> ConvNeXt: ) -> ConvNeXt:
r"""ConvNeXt Large model architecture from the """ConvNeXt Large model architecture from the
`"A ConvNet for the 2020s" <https://arxiv.org/abs/2201.03545>`_ paper. `A ConvNet for the 2020s <https://arxiv.org/abs/2201.03545>`_ paper.
Args: Args:
weights (ConvNeXt_Large_Weights, optional): The pretrained weights for the model weights (:class:`~torchvision.models.convnext.ConvNeXt_Large_Weights`, optional): The pretrained
progress (bool): If True, displays a progress bar of the download to stderr weights to use. See :class:`~torchvision.models.convnext.ConvNeXt_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.convnext.ConvNext``
base class. Please refer to the `source code
<https://github.com/pytorch/vision/blob/main/torchvision/models/convnext.py>`_
for more details about this class.
.. autoclass:: torchvision.models.convnext.ConvNeXt_Large_Weights
:members:
""" """
weights = ConvNeXt_Large_Weights.verify(weights) weights = ConvNeXt_Large_Weights.verify(weights)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment