Skip to content

Commit

Permalink
Fix size propagtion for px unshuffle
Browse files Browse the repository at this point in the history
  • Loading branch information
yhna940 committed Feb 22, 2023
1 parent 489736e commit d6fcddc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions mmedit/models/common/downsample.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ def pixel_unshuffle(x, scale):
raise AssertionError(
f'Invalid scale ({scale}) of pixel unshuffle for tensor '
f'with shape: {x.shape}')
h = torch.div(h, scale, rounding_mode='floor')
w = torch.div(w, scale, rounding_mode='floor')
x = x.view(b, c, h, scale, w, scale)
h = h // scale
w = w // scale
size = torch.Size([b, c, h, scale, w, scale])
x = x.view(size)
x = x.permute(0, 1, 3, 5, 2, 4)
return x.reshape(b, -1, h, w)

0 comments on commit d6fcddc

Please sign in to comment.