From 5a1a8f1088a96a71cc7ffc025d14f41281ea1263 Mon Sep 17 00:00:00 2001 From: Ryan <23580140+brianhou0208@users.noreply.github.com> Date: Fri, 6 Dec 2024 21:47:10 +0800 Subject: [PATCH] Speedup Segformer decoder (#998) --- segmentation_models_pytorch/decoders/segformer/decoder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/segmentation_models_pytorch/decoders/segformer/decoder.py b/segmentation_models_pytorch/decoders/segformer/decoder.py index c2970e1f..daa78b37 100644 --- a/segmentation_models_pytorch/decoders/segformer/decoder.py +++ b/segmentation_models_pytorch/decoders/segformer/decoder.py @@ -15,7 +15,7 @@ def forward(self, x: torch.Tensor): batch, _, height, width = x.shape x = x.flatten(2).transpose(1, 2) x = self.linear(x) - x = x.transpose(1, 2).reshape(batch, -1, height, width).contiguous() + x = x.transpose(1, 2).reshape(batch, -1, height, width) return x