[Fix] Fix performance issue in convnext DDP train. ()

to fix performance issue in convnext DDP train
pull/1159/head
790475019 2022-10-17 10:10:19 +08:00 committed by GitHub
parent bcadb74d5b
commit 38040d5e05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions
mmcls/models/backbones

View File

@ -36,8 +36,8 @@ class LayerNorm2d(nn.LayerNorm):
assert x.dim() == 4, 'LayerNorm2d only supports inputs with shape ' \
f'(N, C, H, W), but got tensor with shape {x.shape}'
return F.layer_norm(
x.permute(0, 2, 3, 1), self.normalized_shape, self.weight,
self.bias, self.eps).permute(0, 3, 1, 2)
x.permute(0, 2, 3, 1).contiguous(), self.normalized_shape,
self.weight, self.bias, self.eps).permute(0, 3, 1, 2).contiguous()
class ConvNeXtBlock(BaseModule):