Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion mmseg/models/backbones/ddrnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,14 @@ def _make_layer(self, block, inplanes, planes, num_blocks, stride=1):

def forward(self, x):
"""Forward function."""
out_size = (x.shape[-2] // 8, x.shape[-1] // 8)

# stage 0-2
x = self.stem(x)

# Use actual spatial dims after stem to avoid off-by-one errors
# when input resolution is not perfectly divisible by 8.
out_size = x.shape[-2:]

Comment on lines +187 to +190

Copilot AI Apr 25, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This bug fix isn’t covered by a regression test. Please add a unit test for DDRNet that feeds an input whose H/W aren’t divisible by 8 (e.g. 1025x1023 or a keep_ratio-like shape) and asserts the forward pass runs without error and that the feature maps being added/resized have matching spatial shapes.

Copilot uses AI. Check for mistakes.
# stage3
x_c = self.context_branch_layers[0](x)
x_s = self.spatial_branch_layers[0](x)
Expand Down
Loading