fix: reverse decoder concat order to match Torch (c4,c3,c2,c1)
Torch decoder concatenates feature projections as [c4,c3,c2,c1] but MLX was using [c1,c2,c3,c4]. The linear_fuse conv was trained with the Torch order, producing scrambled features. Verified fix gives correlation=1.0 against Torch on identical inputs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
81967ccc7c
commit
9cd800d37b
@ -86,8 +86,8 @@ class DecoderHead(nn.Module):
|
||||
x = up(x)
|
||||
projected.append(x)
|
||||
|
||||
# Concatenate along channel dim (last dim in NHWC)
|
||||
fused = mx.concatenate(projected, axis=-1) # (B, H/4, W/4, embed_dim*4)
|
||||
# Concatenate in c4, c3, c2, c1 order to match Torch decoder
|
||||
fused = mx.concatenate(projected[::-1], axis=-1) # (B, H/4, W/4, embed_dim*4)
|
||||
fused = self.linear_fuse(fused)
|
||||
fused = self.bn(fused)
|
||||
fused = nn.relu(fused)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user