From e00bc49580bfd0e3873689ea49abe40d665f76b9 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Tue, 30 Sep 2025 15:28:52 +0100 Subject: [PATCH] Fix Docs YAML guide missing docstrings (#22264) Co-authored-by: UltralyticsAssistant --- docs/en/guides/model-yaml-config.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/en/guides/model-yaml-config.md b/docs/en/guides/model-yaml-config.md index 887d8dce..ed0bdd67 100644 --- a/docs/en/guides/model-yaml-config.md +++ b/docs/en/guides/model-yaml-config.md @@ -235,11 +235,15 @@ Modifying the source code is the most versatile way to integrate your custom mod ```python class CustomBlock(nn.Module): + """Custom block with Conv-BatchNorm-ReLU sequence.""" + def __init__(self, c1, c2): + """Initialize CustomBlock with input and output channels.""" super().__init__() self.layers = nn.Sequential(nn.Conv2d(c1, c2, 3, 1, 1), nn.BatchNorm2d(c2), nn.ReLU()) def forward(self, x): + """Forward pass through the block.""" return self.layers(x) ``` @@ -258,7 +262,8 @@ Modifying the source code is the most versatile way to integrate your custom mod 5. **Handle special arguments** (if needed) inside [`parse_model()`](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/nn/tasks.py) in `ultralytics/nn/tasks.py`: ```python - elif m is CustomBlock: + # Add this condition in the parse_model() function + if m is CustomBlock: c1, c2 = ch[f], args[0] # input channels, output channels args = [c1, c2, *args[1:]] ```