Fix Docs YAML guide missing docstrings (#22264)
Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
parent
4357d6923a
commit
e00bc49580
@ -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:]]
|
||||
```
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user