|
|
|
@ -243,9 +243,9 @@ def window_partition(x, window_size: Tuple[int, int]):
|
|
|
|
|
@register_notrace_function # reason: int argument is a Proxy
|
|
|
|
|
def window_reverse(windows, window_size: Tuple[int, int], img_size: Tuple[int, int]):
|
|
|
|
|
H, W = img_size
|
|
|
|
|
B = int(windows.shape[0] / (H * W / window_size[0] / window_size[1]))
|
|
|
|
|
x = windows.view(B, H // window_size[0], W // window_size[1], window_size[0], window_size[1], -1)
|
|
|
|
|
x = x.permute(0, 1, 3, 2, 4, 5).contiguous().view(B, H, W, -1)
|
|
|
|
|
C = windows.shape[-1]
|
|
|
|
|
x = windows.view(-1, H // window_size[0], W // window_size[1], window_size[0], window_size[1], C)
|
|
|
|
|
x = x.permute(0, 1, 3, 2, 4, 5).contiguous().view(-1, H, W, C)
|
|
|
|
|
return x
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|