Skip to content

Commit

Permalink
bug: Fix PatchMerging duplicate merging (#8285)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
pooya-mohammadi authored Jan 10, 2025
1 parent 9eb0a8c commit 1c00ea2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions monai/networks/nets/swin_unetr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1c00ea2

Please sign in to comment.