Skip to content

Commit 66ed693

Browse files
authored
Added revamped docs for DenseNet (#5878)
* added dense net docs * fix models_new.rst
1 parent de31e4b commit 66ed693

File tree

3 files changed

+84
-20
lines changed

3 files changed

+84
-20
lines changed

docs/source/models/densenet.rst

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
DenseNet
2+
========
3+
4+
.. currentmodule:: torchvision.models
5+
6+
The DenseNet model is based on the `Densely Connected Convolutional Networks
7+
<https://arxiv.org/abs/1608.06993>`_ paper.
8+
9+
10+
Model builders
11+
--------------
12+
13+
The following model builders can be used to instantiate a DenseNet model, with or
14+
without pre-trained weights. All the model builders internally rely on the
15+
``torchvision.models.densenet.DenseNet`` base class. Please refer to the `source
16+
code
17+
<https://github.com/pytorch/vision/blob/main/torchvision/models/densenet.py>`_ for
18+
more details about this class.
19+
20+
.. autosummary::
21+
:toctree: generated/
22+
:template: function.rst
23+
24+
densenet121
25+
densenet161
26+
densenet169
27+
densenet201

docs/source/models_new.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ weights:
3737
:maxdepth: 1
3838

3939
models/convnext
40+
models/densenet
4041
models/efficientnet
4142
models/efficientnetv2
4243
models/regnet

torchvision/models/densenet.py

Lines changed: 56 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -339,14 +339,23 @@ class DenseNet201_Weights(WeightsEnum):
339339
@handle_legacy_interface(weights=("pretrained", DenseNet121_Weights.IMAGENET1K_V1))
340340
def densenet121(*, weights: Optional[DenseNet121_Weights] = None, progress: bool = True, **kwargs: Any) -> DenseNet:
341341
r"""Densenet-121 model from
342-
`"Densely Connected Convolutional Networks" <https://arxiv.org/pdf/1608.06993.pdf>`_.
342+
`Densely Connected Convolutional Networks <https://arxiv.org/abs/1608.06993>`_.
343343
The required minimum input size of the model is 29x29.
344344
345345
Args:
346-
weights (DenseNet121_Weights, optional): The pretrained weights for the model
347-
progress (bool): If True, displays a progress bar of the download to stderr
348-
memory_efficient (bool) - If True, uses checkpointing. Much more memory efficient,
349-
but slower. Default: *False*. See `"paper" <https://arxiv.org/pdf/1707.06990.pdf>`_.
346+
weights (:class:`~torchvision.models.DenseNet121_Weights`, optional): The
347+
pretrained weights to use. See
348+
:class:`~torchvision.models.DenseNet121_Weights` below for
349+
more details, and possible values. By default, no pre-trained
350+
weights are used.
351+
progress (bool, optional): If True, displays a progress bar of the download to stderr. Default is True.
352+
**kwargs: parameters passed to the ``torchvision.models.densenet.DenseNet``
353+
base class. Please refer to the `source code
354+
<https://github.com/pytorch/vision/blob/main/torchvision/models/densenet.py>`_
355+
for more details about this class.
356+
357+
.. autoclass:: torchvision.models.DenseNet121_Weights
358+
:members:
350359
"""
351360
weights = DenseNet121_Weights.verify(weights)
352361

@@ -356,14 +365,23 @@ def densenet121(*, weights: Optional[DenseNet121_Weights] = None, progress: bool
356365
@handle_legacy_interface(weights=("pretrained", DenseNet161_Weights.IMAGENET1K_V1))
357366
def densenet161(*, weights: Optional[DenseNet161_Weights] = None, progress: bool = True, **kwargs: Any) -> DenseNet:
358367
r"""Densenet-161 model from
359-
`"Densely Connected Convolutional Networks" <https://arxiv.org/pdf/1608.06993.pdf>`_.
368+
`Densely Connected Convolutional Networks <https://arxiv.org/abs/1608.06993>`_.
360369
The required minimum input size of the model is 29x29.
361370
362371
Args:
363-
weights (DenseNet161_Weights, optional): The pretrained weights for the model
364-
progress (bool): If True, displays a progress bar of the download to stderr
365-
memory_efficient (bool) - If True, uses checkpointing. Much more memory efficient,
366-
but slower. Default: *False*. See `"paper" <https://arxiv.org/pdf/1707.06990.pdf>`_.
372+
weights (:class:`~torchvision.models.DenseNet161_Weights`, optional): The
373+
pretrained weights to use. See
374+
:class:`~torchvision.models.DenseNet161_Weights` below for
375+
more details, and possible values. By default, no pre-trained
376+
weights are used.
377+
progress (bool, optional): If True, displays a progress bar of the download to stderr. Default is True.
378+
**kwargs: parameters passed to the ``torchvision.models.densenet.DenseNet``
379+
base class. Please refer to the `source code
380+
<https://github.com/pytorch/vision/blob/main/torchvision/models/densenet.py>`_
381+
for more details about this class.
382+
383+
.. autoclass:: torchvision.models.DenseNet161_Weights
384+
:members:
367385
"""
368386
weights = DenseNet161_Weights.verify(weights)
369387

@@ -373,14 +391,23 @@ def densenet161(*, weights: Optional[DenseNet161_Weights] = None, progress: bool
373391
@handle_legacy_interface(weights=("pretrained", DenseNet169_Weights.IMAGENET1K_V1))
374392
def densenet169(*, weights: Optional[DenseNet169_Weights] = None, progress: bool = True, **kwargs: Any) -> DenseNet:
375393
r"""Densenet-169 model from
376-
`"Densely Connected Convolutional Networks" <https://arxiv.org/pdf/1608.06993.pdf>`_.
394+
`Densely Connected Convolutional Networks <https://arxiv.org/abs/1608.06993>`_.
377395
The required minimum input size of the model is 29x29.
378396
379397
Args:
380-
weights (DenseNet169_Weights, optional): The pretrained weights for the model
381-
progress (bool): If True, displays a progress bar of the download to stderr
382-
memory_efficient (bool) - If True, uses checkpointing. Much more memory efficient,
383-
but slower. Default: *False*. See `"paper" <https://arxiv.org/pdf/1707.06990.pdf>`_.
398+
weights (:class:`~torchvision.models.DenseNet169_Weights`, optional): The
399+
pretrained weights to use. See
400+
:class:`~torchvision.models.DenseNet169_Weights` below for
401+
more details, and possible values. By default, no pre-trained
402+
weights are used.
403+
progress (bool, optional): If True, displays a progress bar of the download to stderr. Default is True.
404+
**kwargs: parameters passed to the ``torchvision.models.densenet.DenseNet``
405+
base class. Please refer to the `source code
406+
<https://github.com/pytorch/vision/blob/main/torchvision/models/densenet.py>`_
407+
for more details about this class.
408+
409+
.. autoclass:: torchvision.models.DenseNet169_Weights
410+
:members:
384411
"""
385412
weights = DenseNet169_Weights.verify(weights)
386413

@@ -390,14 +417,23 @@ def densenet169(*, weights: Optional[DenseNet169_Weights] = None, progress: bool
390417
@handle_legacy_interface(weights=("pretrained", DenseNet201_Weights.IMAGENET1K_V1))
391418
def densenet201(*, weights: Optional[DenseNet201_Weights] = None, progress: bool = True, **kwargs: Any) -> DenseNet:
392419
r"""Densenet-201 model from
393-
`"Densely Connected Convolutional Networks" <https://arxiv.org/pdf/1608.06993.pdf>`_.
420+
`Densely Connected Convolutional Networks <https://arxiv.org/abs/1608.06993>`_.
394421
The required minimum input size of the model is 29x29.
395422
396423
Args:
397-
weights (DenseNet201_Weights, optional): The pretrained weights for the model
398-
progress (bool): If True, displays a progress bar of the download to stderr
399-
memory_efficient (bool) - If True, uses checkpointing. Much more memory efficient,
400-
but slower. Default: *False*. See `"paper" <https://arxiv.org/pdf/1707.06990.pdf>`_.
424+
weights (:class:`~torchvision.models.DenseNet201_Weights`, optional): The
425+
pretrained weights to use. See
426+
:class:`~torchvision.models.DenseNet201_Weights` below for
427+
more details, and possible values. By default, no pre-trained
428+
weights are used.
429+
progress (bool, optional): If True, displays a progress bar of the download to stderr. Default is True.
430+
**kwargs: parameters passed to the ``torchvision.models.densenet.DenseNet``
431+
base class. Please refer to the `source code
432+
<https://github.com/pytorch/vision/blob/main/torchvision/models/densenet.py>`_
433+
for more details about this class.
434+
435+
.. autoclass:: torchvision.models.DenseNet201_Weights
436+
:members:
401437
"""
402438
weights = DenseNet201_Weights.verify(weights)
403439

0 commit comments

Comments
 (0)