Skip to content

Commit

Permalink
Add missing Python function docstrings (#2227)
Browse files Browse the repository at this point in the history
* Add missing Python function docstrings

* Auto-format by https://ultralytics.com/actions

---------

Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
  • Loading branch information
glenn-jocher and UltralyticsAssistant committed Jun 19, 2024
1 parent 94a0799 commit 65ab707
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions models/yolo.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ def __init__(self, cfg="yolov5s.yaml", ch=3, nc=None, anchors=None): # model, i
m.inplace = self.inplace

def forward(x):
"""Passes the input 'x' through the model and returns the processed output."""
return self.forward(x)[0] if isinstance(m, Segment) else self.forward(x)

m.stride = torch.tensor([s / x.shape[-2] for x in forward(torch.zeros(1, ch, s, s))]) # forward
Expand Down
2 changes: 1 addition & 1 deletion utils/dataloaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -1209,7 +1209,7 @@ def get_json(self, save=False, verbose=False):
"""

def _round(labels):
# Update labels to integer class and 6 decimal place floats
"""Update labels to integer class and 6 decimal place floats."""
return [[int(c), *(round(x, 4) for x in points)] for c, *points in labels]

for split in "train", "val", "test":
Expand Down
3 changes: 3 additions & 0 deletions utils/loggers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
except ImportError:

def SummaryWriter(*args):
"""Imports TensorBoard's SummaryWriter for logging, with a fallback returning None if TensorBoard is not
installed.
"""
return None # None = SummaryWriter(str)


Expand Down

0 comments on commit 65ab707

Please sign in to comment.