(x)
| 278 | |
| 279 | |
| 280 | def unwindow(x): |
| 281 | *b, h, w, wh, ww, c = x.shape |
| 282 | x = torch.permute(x, (*range(len(b)), -5, -3, -4, -2, -1)) |
| 283 | x = torch.reshape(x, (*b, h * wh, w * ww, c)) |
| 284 | return x |
| 285 | |
| 286 | |
| 287 | def shifted_window(window_size, window_shift, x): |