From 1c00ea22ead498551379cdcdbd7970ca7a6d9464 Mon Sep 17 00:00:00 2001 From: Pooya Mohammadi Kazaj Date: Fri, 10 Jan 2025 16:35:44 +0100 Subject: [PATCH] bug: Fix PatchMerging duplicate merging (#8285) Fixes # . ### Description A few sentences describing the changes proposed in this pull request. ### Types of changes - [x] Non-breaking change (fix or new feature that would not break existing functionality). Fixing issue #8284 In this format there are no duplicates: ``` t = [ (0, 0, 0), (1, 0, 0), (0, 1, 0), (0, 0, 1), (1, 0, 1), (1, 1, 0), (0, 1, 1), (1, 1, 1), ] print(set(t)) # {(1, 0, 1), (1, 1, 0), (0, 1, 0), (0, 0, 0), (1, 0, 0), (0, 0, 1), (1, 1, 1), (0, 1, 1)} ``` --------- Signed-off-by: pooya-mohammadi --- monai/networks/nets/swin_unetr.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/monai/networks/nets/swin_unetr.py b/monai/networks/nets/swin_unetr.py index 77f0d2ec2f..cfc5dda41f 100644 --- a/monai/networks/nets/swin_unetr.py +++ b/monai/networks/nets/swin_unetr.py @@ -782,9 +782,9 @@ def forward(self, x): x1 = x[:, 1::2, 0::2, 0::2, :] x2 = x[:, 0::2, 1::2, 0::2, :] x3 = x[:, 0::2, 0::2, 1::2, :] - x4 = x[:, 1::2, 0::2, 1::2, :] - x5 = x[:, 0::2, 1::2, 0::2, :] - x6 = x[:, 0::2, 0::2, 1::2, :] + x4 = x[:, 1::2, 1::2, 0::2, :] + x5 = x[:, 1::2, 0::2, 1::2, :] + x6 = x[:, 0::2, 1::2, 1::2, :] x7 = x[:, 1::2, 1::2, 1::2, :] x = torch.cat([x0, x1, x2, x3, x4, x5, x6, x7], -1) x = self.norm(x)