mirror of
https://github.com/huggingface/pytorch-image-models.git
synced 2025-06-03 15:01:08 +08:00
Merge pull request #2285 from huggingface/fix_swin_pad
Fix reversed H & W padding for swin patch merging
This commit is contained in:
commit
93374637c6
@ -435,7 +435,7 @@ class PatchMerging(nn.Module):
|
||||
def forward(self, x):
|
||||
B, H, W, C = x.shape
|
||||
|
||||
pad_values = (0, 0, 0, H % 2, 0, W % 2)
|
||||
pad_values = (0, 0, 0, W % 2, 0, H % 2)
|
||||
x = nn.functional.pad(x, pad_values)
|
||||
_, H, W, _ = x.shape
|
||||
|
||||
|
@ -439,7 +439,7 @@ class PatchMerging(nn.Module):
|
||||
def forward(self, x: torch.Tensor) -> torch.Tensor:
|
||||
B, H, W, C = x.shape
|
||||
|
||||
pad_values = (0, 0, 0, H % 2, 0, W % 2)
|
||||
pad_values = (0, 0, 0, W % 2, 0, H % 2)
|
||||
x = nn.functional.pad(x, pad_values)
|
||||
_, H, W, _ = x.shape
|
||||
|
||||
|
@ -445,7 +445,7 @@ class PatchMerging(nn.Module):
|
||||
"""
|
||||
B, H, W, C = x.shape
|
||||
|
||||
pad_values = (0, 0, 0, H % 2, 0, W % 2)
|
||||
pad_values = (0, 0, 0, W % 2, 0, H % 2)
|
||||
x = nn.functional.pad(x, pad_values)
|
||||
_, H, W, _ = x.shape
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user