MCPcopy Create free account
hub / github.com/OpenGVLab/HumanBench / window_partition

Function window_partition

PATH/core/models/backbones/vitdet.py:110–121  ·  view source on GitHub ↗

Args: x: (B, H, W, C) window_size (int): window size Returns: windows: (num_windows*B, window_size, window_size, C)

(x, window_size)

Source from the content-addressed store, hash-verified

108
109
110def window_partition(x, window_size):
111 """
112 Args:
113 x: (B, H, W, C)
114 window_size (int): window size
115 Returns:
116 windows: (num_windows*B, window_size, window_size, C)
117 """
118 B, H, W, C = x.shape
119 x = x.view(B, H // window_size, window_size, W // window_size, window_size, C)
120 windows = x.permute(0, 1, 3, 2, 4, 5).contiguous().view(-1, window_size, window_size, C)
121 return windows
122
123
124def window_reverse(windows, window_size, H, W):

Callers 1

forwardMethod · 0.70

Calls 1

permuteMethod · 0.80

Tested by

no test coverage detected