From 1717efadbe74842675c586932d0fd566a87495e3 Mon Sep 17 00:00:00 2001 From: Ma Zerun Date: Fri, 25 Mar 2022 12:34:44 +0800 Subject: [PATCH] [Fix] Fix the discontiguous output feature map of ConvNeXt. (#743) * [Fix] Fix the discontiguous output feature map of ConvNeXt. * Add comment --- mmcls/models/backbones/convnext.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mmcls/models/backbones/convnext.py b/mmcls/models/backbones/convnext.py index 6d61ec954..1e0a3e9c5 100644 --- a/mmcls/models/backbones/convnext.py +++ b/mmcls/models/backbones/convnext.py @@ -312,7 +312,9 @@ class ConvNeXt(BaseBackbone): gap = x.mean([-2, -1], keepdim=True) outs.append(norm_layer(gap).flatten(1)) else: - outs.append(norm_layer(x)) + # The output of LayerNorm2d may be discontiguous, which + # may cause some problem in the downstream tasks + outs.append(norm_layer(x).contiguous()) return tuple(outs)