Skip to content

Commit face20b

Browse files
authored
Add documentation for ShuffleNet plus minor doc fixes (#932)
1 parent 041b8ba commit face20b

File tree

4 files changed

+47
-4
lines changed

4 files changed

+47
-4
lines changed

docs/source/models.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,10 @@ GoogLeNet
171171
ShuffleNet v2
172172
-------------
173173

174-
.. autofunction:: shufflenet
174+
.. autofunction:: shufflenet_v2_x0_5
175+
.. autofunction:: shufflenet_v2_x1_0
176+
.. autofunction:: shufflenet_v2_x1_5
177+
.. autofunction:: shufflenet_v2_x2_0
175178

176179
MobileNet v2
177180
-------------

torchvision/datasets/cityscapes.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class Cityscapes(VisionDataset):
2727
Get semantic segmentation target
2828
2929
.. code-block:: python
30+
3031
dataset = Cityscapes('./data/cityscapes', split='train', mode='fine',
3132
target_type='semantic')
3233
@@ -35,6 +36,7 @@ class Cityscapes(VisionDataset):
3536
Get multiple targets
3637
3738
.. code-block:: python
39+
3840
dataset = Cityscapes('./data/cityscapes', split='train', mode='fine',
3941
target_type=['instance', 'color', 'polygon'])
4042
@@ -43,6 +45,7 @@ class Cityscapes(VisionDataset):
4345
Validate on the "coarse" set
4446
4547
.. code-block:: python
48+
4649
dataset = Cityscapes('./data/cityscapes', split='val', mode='coarse',
4750
target_type='semantic')
4851

torchvision/models/shufflenetv2.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,20 +146,56 @@ def _shufflenetv2(arch, pretrained, progress, *args, **kwargs):
146146

147147

148148
def shufflenet_v2_x0_5(pretrained=False, progress=True, **kwargs):
149+
"""
150+
Constructs a ShuffleNetV2 with 0.5x output channels, as described in
151+
`"ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design"
152+
<https://arxiv.org/abs/1807.11164>`_.
153+
154+
Args:
155+
pretrained (bool): If True, returns a model pre-trained on ImageNet
156+
progress (bool): If True, displays a progress bar of the download to stderr
157+
"""
149158
return _shufflenetv2('shufflenetv2_x0.5', pretrained, progress,
150159
[4, 8, 4], [24, 48, 96, 192, 1024], **kwargs)
151160

152161

153162
def shufflenet_v2_x1_0(pretrained=False, progress=True, **kwargs):
163+
"""
164+
Constructs a ShuffleNetV2 with 1.0x output channels, as described in
165+
`"ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design"
166+
<https://arxiv.org/abs/1807.11164>`_.
167+
168+
Args:
169+
pretrained (bool): If True, returns a model pre-trained on ImageNet
170+
progress (bool): If True, displays a progress bar of the download to stderr
171+
"""
154172
return _shufflenetv2('shufflenetv2_x1.0', pretrained, progress,
155173
[4, 8, 4], [24, 116, 232, 464, 1024], **kwargs)
156174

157175

158176
def shufflenet_v2_x1_5(pretrained=False, progress=True, **kwargs):
177+
"""
178+
Constructs a ShuffleNetV2 with 1.5x output channels, as described in
179+
`"ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design"
180+
<https://arxiv.org/abs/1807.11164>`_.
181+
182+
Args:
183+
pretrained (bool): If True, returns a model pre-trained on ImageNet
184+
progress (bool): If True, displays a progress bar of the download to stderr
185+
"""
159186
return _shufflenetv2('shufflenetv2_x1.5', pretrained, progress,
160187
[4, 8, 4], [24, 176, 352, 704, 1024], **kwargs)
161188

162189

163190
def shufflenet_v2_x2_0(pretrained=False, progress=True, **kwargs):
191+
"""
192+
Constructs a ShuffleNetV2 with 2.0x output channels, as described in
193+
`"ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design"
194+
<https://arxiv.org/abs/1807.11164>`_.
195+
196+
Args:
197+
pretrained (bool): If True, returns a model pre-trained on ImageNet
198+
progress (bool): If True, displays a progress bar of the download to stderr
199+
"""
164200
return _shufflenetv2('shufflenetv2_x2.0', pretrained, progress,
165201
[4, 8, 4], [24, 244, 488, 976, 2048], **kwargs)

torchvision/transforms/transforms.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class ToPILImage(object):
108108
- If the input has 3 channels, the ``mode`` is assumed to be ``RGB``.
109109
- If the input has 2 channels, the ``mode`` is assumed to be ``LA``.
110110
- If the input has 1 channel, the ``mode`` is determined by the data type (i.e ``int``, ``float``,
111-
``short``).
111+
``short``).
112112
113113
.. _PIL.Image mode: https://pillow.readthedocs.io/en/latest/handbook/concepts.html#concept-modes
114114
"""
@@ -785,8 +785,9 @@ class LinearTransformation(object):
785785
786786
Applications:
787787
whitening transformation: Suppose X is a column vector zero-centered data.
788-
Then compute the data covariance matrix [D x D] with torch.mm(X.t(), X),
789-
perform SVD on this matrix and pass it as transformation_matrix.
788+
Then compute the data covariance matrix [D x D] with torch.mm(X.t(), X),
789+
perform SVD on this matrix and pass it as transformation_matrix.
790+
790791
Args:
791792
transformation_matrix (Tensor): tensor [D x D], D = C x H x W
792793
mean_vector (Tensor): tensor [D], D = C x H x W

0 commit comments

Comments
 (0)