MCPcopy Create free account
hub / github.com/GuoLanqing/ShadowFormer / window_reverse

Function window_reverse

model.py:550–559  ·  view source on GitHub ↗
(windows, win_size, H, W, dilation_rate=1)

Source from the content-addressed store, hash-verified

548 return windows
549
550def window_reverse(windows, win_size, H, W, dilation_rate=1):
551 # B' ,Wh ,Ww ,C
552 B = int(windows.shape[0] / (H * W / win_size / win_size))
553 x = windows.view(B, H // win_size, W // win_size, win_size, win_size, -1)
554 if dilation_rate !=1:
555 x = windows.permute(0,5,3,4,1,2).contiguous() # B, C*Wh*Ww, H/Wh*W/Ww
556 x = F.fold(x, (H, W), kernel_size=win_size, dilation=dilation_rate, padding=4*(dilation_rate-1),stride=win_size)
557 else:
558 x = x.permute(0, 1, 3, 2, 4, 5).contiguous().view(B, H, W, -1)
559 return x
560
561#########################################
562# Downsample Block

Callers 1

forwardMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected