Skip to content

Commit 65238ce

Browse files
zhiqwangNicolasHug
andauthored
Add revamped docs for ShuffleNet V2 (#5921)
* Update ShuffleNetV2 docstring * Add entry for ShuffleNet V2 in new doc * Minor fixes Co-authored-by: Nicolas Hug <[email protected]>
1 parent 4d61aeb commit 65238ce

File tree

3 files changed

+96
-20
lines changed

3 files changed

+96
-20
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
ShuffleNet V2
2+
=============
3+
4+
.. currentmodule:: torchvision.models
5+
6+
The ShuffleNet V2 model is based on the `ShuffleNet V2: Practical Guidelines for Efficient
7+
CNN Architecture Design <https://arxiv.org/abs/1807.11164>`__ paper.
8+
9+
10+
Model builders
11+
--------------
12+
13+
The following model builders can be used to instantiate a ShuffleNetV2 model, with or
14+
without pre-trained weights. All the model builders internally rely on the
15+
``torchvision.models.shufflenetv2.ShuffleNetV2`` base class. Please refer to the `source
16+
code
17+
<https://github.com/pytorch/vision/blob/main/torchvision/models/shufflenetv2.py>`_ for
18+
more details about this class.
19+
20+
.. autosummary::
21+
:toctree: generated/
22+
:template: function.rst
23+
24+
shufflenet_v2_x0_5
25+
shufflenet_v2_x1_0
26+
shufflenet_v2_x1_5
27+
shufflenet_v2_x2_0

docs/source/models_new.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ weights:
4848
models/regnet
4949
models/resnet
5050
models/resnext
51+
models/shufflenetv2
5152
models/squeezenet
5253
models/swin_transformer
5354
models/vgg

torchvision/models/shufflenetv2.py

Lines changed: 68 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -261,13 +261,25 @@ def shufflenet_v2_x0_5(
261261
*, weights: Optional[ShuffleNet_V2_X0_5_Weights] = None, progress: bool = True, **kwargs: Any
262262
) -> ShuffleNetV2:
263263
"""
264-
Constructs a ShuffleNetV2 with 0.5x output channels, as described in
265-
`"ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design"
266-
<https://arxiv.org/abs/1807.11164>`_.
264+
Constructs a ShuffleNetV2 architecture with 0.5x output channels, as described in
265+
`ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design
266+
<https://arxiv.org/abs/1807.11164>`__.
267267
268268
Args:
269-
weights (ShuffleNet_V2_X0_5_Weights, optional): The pretrained weights for the model
270-
progress (bool): If True, displays a progress bar of the download to stderr
269+
weights (:class:`~torchvision.models.ShuffleNet_V2_X0_5_Weights`, optional): The
270+
pretrained weights to use. See
271+
:class:`~torchvision.models.ShuffleNet_V2_X0_5_Weights` below for
272+
more details, and possible values. By default, no pre-trained
273+
weights are used.
274+
progress (bool, optional): If True, displays a progress bar of the
275+
download to stderr. Default is True.
276+
**kwargs: parameters passed to the ``torchvision.models.shufflenetv2.ShuffleNetV2``
277+
base class. Please refer to the `source code
278+
<https://github.com/pytorch/vision/blob/main/torchvision/models/shufflenetv2.py>`_
279+
for more details about this class.
280+
281+
.. autoclass:: torchvision.models.ShuffleNet_V2_X0_5_Weights
282+
:members:
271283
"""
272284
weights = ShuffleNet_V2_X0_5_Weights.verify(weights)
273285

@@ -279,13 +291,25 @@ def shufflenet_v2_x1_0(
279291
*, weights: Optional[ShuffleNet_V2_X1_0_Weights] = None, progress: bool = True, **kwargs: Any
280292
) -> ShuffleNetV2:
281293
"""
282-
Constructs a ShuffleNetV2 with 1.0x output channels, as described in
283-
`"ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design"
284-
<https://arxiv.org/abs/1807.11164>`_.
294+
Constructs a ShuffleNetV2 architecture with 1.0x output channels, as described in
295+
`ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design
296+
<https://arxiv.org/abs/1807.11164>`__.
285297
286298
Args:
287-
weights (ShuffleNet_V2_X1_0_Weights, optional): The pretrained weights for the model
288-
progress (bool): If True, displays a progress bar of the download to stderr
299+
weights (:class:`~torchvision.models.ShuffleNet_V2_X1_0_Weights`, optional): The
300+
pretrained weights to use. See
301+
:class:`~torchvision.models.ShuffleNet_V2_X1_0_Weights` below for
302+
more details, and possible values. By default, no pre-trained
303+
weights are used.
304+
progress (bool, optional): If True, displays a progress bar of the
305+
download to stderr. Default is True.
306+
**kwargs: parameters passed to the ``torchvision.models.shufflenetv2.ShuffleNetV2``
307+
base class. Please refer to the `source code
308+
<https://github.com/pytorch/vision/blob/main/torchvision/models/shufflenetv2.py>`_
309+
for more details about this class.
310+
311+
.. autoclass:: torchvision.models.ShuffleNet_V2_X1_0_Weights
312+
:members:
289313
"""
290314
weights = ShuffleNet_V2_X1_0_Weights.verify(weights)
291315

@@ -297,13 +321,25 @@ def shufflenet_v2_x1_5(
297321
*, weights: Optional[ShuffleNet_V2_X1_5_Weights] = None, progress: bool = True, **kwargs: Any
298322
) -> ShuffleNetV2:
299323
"""
300-
Constructs a ShuffleNetV2 with 1.5x output channels, as described in
301-
`"ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design"
302-
<https://arxiv.org/abs/1807.11164>`_.
324+
Constructs a ShuffleNetV2 architecture with 1.5x output channels, as described in
325+
`ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design
326+
<https://arxiv.org/abs/1807.11164>`__.
303327
304328
Args:
305-
weights (ShuffleNet_V2_X1_5_Weights, optional): The pretrained weights for the model
306-
progress (bool): If True, displays a progress bar of the download to stderr
329+
weights (:class:`~torchvision.models.ShuffleNet_V2_X1_5_Weights`, optional): The
330+
pretrained weights to use. See
331+
:class:`~torchvision.models.ShuffleNet_V2_X1_5_Weights` below for
332+
more details, and possible values. By default, no pre-trained
333+
weights are used.
334+
progress (bool, optional): If True, displays a progress bar of the
335+
download to stderr. Default is True.
336+
**kwargs: parameters passed to the ``torchvision.models.shufflenetv2.ShuffleNetV2``
337+
base class. Please refer to the `source code
338+
<https://github.com/pytorch/vision/blob/main/torchvision/models/shufflenetv2.py>`_
339+
for more details about this class.
340+
341+
.. autoclass:: torchvision.models.ShuffleNet_V2_X1_5_Weights
342+
:members:
307343
"""
308344
weights = ShuffleNet_V2_X1_5_Weights.verify(weights)
309345

@@ -315,13 +351,25 @@ def shufflenet_v2_x2_0(
315351
*, weights: Optional[ShuffleNet_V2_X2_0_Weights] = None, progress: bool = True, **kwargs: Any
316352
) -> ShuffleNetV2:
317353
"""
318-
Constructs a ShuffleNetV2 with 2.0x output channels, as described in
319-
`"ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design"
320-
<https://arxiv.org/abs/1807.11164>`_.
354+
Constructs a ShuffleNetV2 architecture with 2.0x output channels, as described in
355+
`ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design
356+
<https://arxiv.org/abs/1807.11164>`__.
321357
322358
Args:
323-
weights (ShuffleNet_V2_X2_0_Weights, optional): The pretrained weights for the model
324-
progress (bool): If True, displays a progress bar of the download to stderr
359+
weights (:class:`~torchvision.models.ShuffleNet_V2_X2_0_Weights`, optional): The
360+
pretrained weights to use. See
361+
:class:`~torchvision.models.ShuffleNet_V2_X2_0_Weights` below for
362+
more details, and possible values. By default, no pre-trained
363+
weights are used.
364+
progress (bool, optional): If True, displays a progress bar of the
365+
download to stderr. Default is True.
366+
**kwargs: parameters passed to the ``torchvision.models.shufflenetv2.ShuffleNetV2``
367+
base class. Please refer to the `source code
368+
<https://github.com/pytorch/vision/blob/main/torchvision/models/shufflenetv2.py>`_
369+
for more details about this class.
370+
371+
.. autoclass:: torchvision.models.ShuffleNet_V2_X2_0_Weights
372+
:members:
325373
"""
326374
weights = ShuffleNet_V2_X2_0_Weights.verify(weights)
327375

0 commit comments

Comments
 (0)