Convert list to tuple.

This commit is contained in:
zh-plus
2023-04-26 11:45:03 +08:00
parent 284a2ea114
commit 91f020ee35
2 changed files with 4 additions and 2 deletions

View File

@@ -75,8 +75,8 @@ class BaseInpainter:
size[1] += 1
masks = np.expand_dims(masks, axis=3) # expand to T, H, W, 1
binary_masks = resize_masks(masks, size)
frames = resize_frames(frames, size) # T, H, W, 3
binary_masks = resize_masks(masks, tuple(size))
frames = resize_frames(frames, tuple(size)) # T, H, W, 3
# frames and binary_masks are numpy arrays
h, w = frames.shape[1:3]

View File

@@ -128,8 +128,10 @@ def window_partition(x, window_size):
windows: (B*num_windows, T*window_size*window_size, C)
"""
B, T, H, W, C = x.shape
x = x.view(B, T, H // window_size[0], window_size[0], W // window_size[1],
window_size[1], C)
windows = x.permute(0, 2, 4, 1, 3, 5, 6).contiguous().view(
-1, T * window_size[0] * window_size[1], C)
return windows