Add missing Python function docstrings (#13105)

* Add missing Python function docstrings

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

---------

Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
Co-authored-by: Ultralytics Assistant <135830346+UltralyticsAssistant@users.noreply.github.com>
pull/13112/head
Glenn Jocher 2024-06-19 02:29:08 +02:00 committed by GitHub
parent cf8933caca
commit ec331cbda7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 4 deletions

View File

@ -242,13 +242,14 @@ class DetectionModel(BaseModel):
# Build strides, anchors
m = self.model[-1] # Detect()
if isinstance(m, (Detect, Segment)):
s = 256 # 2x min stride
m.inplace = self.inplace
def forward(x):
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
s = 256 # 2x min stride
m.inplace = self.inplace
m.stride = torch.tensor([s / x.shape[-2] for x in _forward(torch.zeros(1, ch, s, s))]) # forward
check_anchor_order(m)
m.anchors /= m.stride.view(-1, 1, 1)
self.stride = m.stride

View File

@ -23,6 +23,7 @@ try:
except ImportError:
def SummaryWriter(*args):
"""Fall back to SummaryWriter returning None if TensorBoard is not installed."""
return None # None = SummaryWriter(str)