Skip to content

Commit 6116812

Browse files
NicolasHugdatumbox
andauthored
Document undocumented parameters (#3299)
* Document undodcumented parameters * remove setup.cfg changes * Properly pass normalize down instead of deprecating it * Fix flake8 * Add new CI check * Fix type spec * Leave normalize be part of kwargs Co-authored-by: Vasilis Vryniotis <[email protected]>
1 parent 59df482 commit 6116812

File tree

13 files changed

+50
-4
lines changed

13 files changed

+50
-4
lines changed

.circleci/config.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,16 @@ jobs:
120120
pip install --user --progress-bar off --editable .
121121
mypy --config-file mypy.ini
122122
123+
docstring_parameters_sync:
124+
docker:
125+
- image: circleci/python:3.7
126+
steps:
127+
- checkout
128+
- run:
129+
command: |
130+
pip install --user pydocstyle
131+
pydocstyle
132+
123133
clang_format:
124134
docker:
125135
- image: circleci/python:3.7
@@ -1167,6 +1177,7 @@ workflows:
11671177
- build_docs
11681178
- python_lint
11691179
- python_type_check
1180+
- docstring_parameters_sync
11701181
- clang_format
11711182
- torchhub_test
11721183
- torch_onnx_test
@@ -1283,6 +1294,7 @@ workflows:
12831294
- circleci_consistency
12841295
- python_lint
12851296
- python_type_check
1297+
- docstring_parameters_sync
12861298
- clang_format
12871299
- torchhub_test
12881300
- torch_onnx_test

.circleci/config.yml.in

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,16 @@ jobs:
120120
pip install --user --progress-bar off --editable .
121121
mypy --config-file mypy.ini
122122

123+
docstring_parameters_sync:
124+
docker:
125+
- image: circleci/python:3.7
126+
steps:
127+
- checkout
128+
- run:
129+
command: |
130+
pip install --user pydocstyle
131+
pydocstyle
132+
123133
clang_format:
124134
docker:
125135
- image: circleci/python:3.7
@@ -778,6 +788,7 @@ workflows:
778788
{{ build_workflows(windows_latest_only=True) }}
779789
- python_lint
780790
- python_type_check
791+
- docstring_parameters_sync
781792
- clang_format
782793
- torchhub_test
783794
- torch_onnx_test
@@ -796,6 +807,7 @@ workflows:
796807
- circleci_consistency
797808
- python_lint
798809
- python_type_check
810+
- docstring_parameters_sync
799811
- clang_format
800812
- torchhub_test
801813
- torch_onnx_test

references/detection/coco_eval.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ def loadRes(self, resFile):
239239
"""
240240
Load result file and return a result api object.
241241
Args:
242+
self (obj): coco object with ground truth annotations
242243
resFile (str): file name of result file
243244
Returns:
244245
res (obj): result api object

setup.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@ max-line-length = 120
1111
max-line-length = 120
1212
ignore = F401,E402,F403,W503,W504,F821
1313
exclude = venv
14+
15+
[pydocstyle]
16+
select = D417 # Missing argument descriptions in the docstring

torchvision/datasets/video_utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ def compute_clips(self, num_frames, step, frame_rate=None):
229229
Args:
230230
num_frames (int): number of frames for the clip
231231
step (int): distance between two clips
232+
frame_rate (int, optional): The frame rate
232233
"""
233234
self.num_frames = num_frames
234235
self.step = step

torchvision/models/detection/_utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ def encode_boxes(reference_boxes, proposals, weights):
8686
Args:
8787
reference_boxes (Tensor): reference boxes
8888
proposals (Tensor): boxes to be encoded
89+
weights (Tensor[4]): the weights for ``(x, y, w, h)``
8990
"""
9091

9192
# perform some unpacking to make it JIT-fusion friendly

torchvision/models/detection/backbone_utils.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,18 @@ def resnet_fpn_backbone(
7676
Args:
7777
backbone_name (string): resnet architecture. Possible values are 'ResNet', 'resnet18', 'resnet34', 'resnet50',
7878
'resnet101', 'resnet152', 'resnext50_32x4d', 'resnext101_32x8d', 'wide_resnet50_2', 'wide_resnet101_2'
79+
pretrained (bool): If True, returns a model with backbone pre-trained on Imagenet
7980
norm_layer (torchvision.ops): it is recommended to use the default value. For details visit:
8081
(https://github.com/facebookresearch/maskrcnn-benchmark/issues/267)
81-
pretrained (bool): If True, returns a model with backbone pre-trained on Imagenet
8282
trainable_layers (int): number of trainable (not frozen) resnet layers starting from final block.
8383
Valid values are between 0 and 5, with 5 meaning all backbone layers are trainable.
84+
returned_layers (list of int): The layers of the network to return. Each entry must be in ``[1, 4]``.
85+
By default all layers are returned.
86+
extra_blocks (ExtraFPNBlock or None): if provided, extra operations will
87+
be performed. It is expected to take the fpn features, the original
88+
features and the names of the original features as input, and returns
89+
a new list of feature maps and their corresponding names. By
90+
default a ``LastLevelMaxPool`` is used.
8491
"""
8592
backbone = resnet.__dict__[backbone_name](
8693
pretrained=pretrained,

torchvision/models/quantization/googlenet.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ def googlenet(pretrained=False, progress=True, quantize=False, **kwargs):
2929
Args:
3030
pretrained (bool): If True, returns a model pre-trained on ImageNet
3131
progress (bool): If True, displays a progress bar of the download to stderr
32+
quantize (bool): If True, return a quantized version of the model
3233
aux_logits (bool): If True, adds two auxiliary branches that can improve training.
3334
Default: *False* when pretrained is True otherwise *True*
3435
transform_input (bool): If True, preprocesses the input according to the method with which it

torchvision/models/quantization/inception.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ def inception_v3(pretrained=False, progress=True, quantize=False, **kwargs):
3838
Args:
3939
pretrained (bool): If True, returns a model pre-trained on ImageNet
4040
progress (bool): If True, displays a progress bar of the download to stderr
41+
quantize (bool): If True, return a quantized version of the model
4142
aux_logits (bool): If True, add an auxiliary branch that can improve training.
4243
Default: *True*
4344
transform_input (bool): If True, preprocesses the input according to the method with which it

torchvision/models/quantization/resnet.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ def resnet18(pretrained=False, progress=True, quantize=False, **kwargs):
143143
Args:
144144
pretrained (bool): If True, returns a model pre-trained on ImageNet
145145
progress (bool): If True, displays a progress bar of the download to stderr
146+
quantize (bool): If True, return a quantized version of the model
146147
"""
147148
return _resnet('resnet18', QuantizableBasicBlock, [2, 2, 2, 2], pretrained, progress,
148149
quantize, **kwargs)
@@ -155,6 +156,7 @@ def resnet50(pretrained=False, progress=True, quantize=False, **kwargs):
155156
Args:
156157
pretrained (bool): If True, returns a model pre-trained on ImageNet
157158
progress (bool): If True, displays a progress bar of the download to stderr
159+
quantize (bool): If True, return a quantized version of the model
158160
"""
159161
return _resnet('resnet50', QuantizableBottleneck, [3, 4, 6, 3], pretrained, progress,
160162
quantize, **kwargs)
@@ -167,6 +169,7 @@ def resnext101_32x8d(pretrained=False, progress=True, quantize=False, **kwargs):
167169
Args:
168170
pretrained (bool): If True, returns a model pre-trained on ImageNet
169171
progress (bool): If True, displays a progress bar of the download to stderr
172+
quantize (bool): If True, return a quantized version of the model
170173
"""
171174
kwargs['groups'] = 32
172175
kwargs['width_per_group'] = 8

torchvision/models/quantization/shufflenetv2.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ def shufflenet_v2_x0_5(pretrained=False, progress=True, quantize=False, **kwargs
107107
Args:
108108
pretrained (bool): If True, returns a model pre-trained on ImageNet
109109
progress (bool): If True, displays a progress bar of the download to stderr
110+
quantize (bool): If True, return a quantized version of the model
110111
"""
111112
return _shufflenetv2('shufflenetv2_x0.5', pretrained, progress, quantize,
112113
[4, 8, 4], [24, 48, 96, 192, 1024], **kwargs)
@@ -121,6 +122,7 @@ def shufflenet_v2_x1_0(pretrained=False, progress=True, quantize=False, **kwargs
121122
Args:
122123
pretrained (bool): If True, returns a model pre-trained on ImageNet
123124
progress (bool): If True, displays a progress bar of the download to stderr
125+
quantize (bool): If True, return a quantized version of the model
124126
"""
125127
return _shufflenetv2('shufflenetv2_x1.0', pretrained, progress, quantize,
126128
[4, 8, 4], [24, 116, 232, 464, 1024], **kwargs)
@@ -135,6 +137,7 @@ def shufflenet_v2_x1_5(pretrained=False, progress=True, quantize=False, **kwargs
135137
Args:
136138
pretrained (bool): If True, returns a model pre-trained on ImageNet
137139
progress (bool): If True, displays a progress bar of the download to stderr
140+
quantize (bool): If True, return a quantized version of the model
138141
"""
139142
return _shufflenetv2('shufflenetv2_x1.5', pretrained, progress, quantize,
140143
[4, 8, 4], [24, 176, 352, 704, 1024], **kwargs)
@@ -149,6 +152,7 @@ def shufflenet_v2_x2_0(pretrained=False, progress=True, quantize=False, **kwargs
149152
Args:
150153
pretrained (bool): If True, returns a model pre-trained on ImageNet
151154
progress (bool): If True, displays a progress bar of the download to stderr
155+
quantize (bool): If True, return a quantized version of the model
152156
"""
153157
return _shufflenetv2('shufflenetv2_x2.0', pretrained, progress, quantize,
154158
[4, 8, 4], [24, 244, 488, 976, 2048], **kwargs)

torchvision/models/segmentation/segmentation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ def deeplabv3_resnet101(pretrained=False, progress=True,
152152
pretrained (bool): If True, returns a model pre-trained on COCO train2017 which
153153
contains the same classes as Pascal VOC
154154
progress (bool): If True, displays a progress bar of the download to stderr
155-
num_classes (int): number of output classes of the model (including the background)
156-
aux_loss (bool): If True, it uses an auxiliary loss
155+
num_classes (int): The number of classes
156+
aux_loss (bool): If True, include an auxiliary classifier
157157
"""
158158
return _load_model('deeplabv3', 'resnet101', pretrained, progress, num_classes, aux_loss, **kwargs)
159159

torchvision/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def draw_bounding_boxes(
153153
154154
Args:
155155
image (Tensor): Tensor of shape (C x H x W)
156-
bboxes (Tensor): Tensor of size (N, 4) containing bounding boxes in (xmin, ymin, xmax, ymax) format. Note that
156+
boxes (Tensor): Tensor of size (N, 4) containing bounding boxes in (xmin, ymin, xmax, ymax) format. Note that
157157
the boxes are absolute coordinates with respect to the image. In other words: `0 <= xmin < xmax < W` and
158158
`0 <= ymin < ymax < H`.
159159
labels (List[str]): List containing the labels of bounding boxes.

0 commit comments

Comments
 (0)