From 91f020ee35ffd1c84e439bf931172d4e22cc41d2 Mon Sep 17 00:00:00 2001 From: zh-plus Date: Wed, 26 Apr 2023 11:45:03 +0800 Subject: [PATCH] Convert list to tuple. --- inpainter/base_inpainter.py | 4 ++-- inpainter/model/modules/tfocal_transformer_hq.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/inpainter/base_inpainter.py b/inpainter/base_inpainter.py index 8e58c4e..18fdfce 100644 --- a/inpainter/base_inpainter.py +++ b/inpainter/base_inpainter.py @@ -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] diff --git a/inpainter/model/modules/tfocal_transformer_hq.py b/inpainter/model/modules/tfocal_transformer_hq.py index 1a24dfa..efabefb 100644 --- a/inpainter/model/modules/tfocal_transformer_hq.py +++ b/inpainter/model/modules/tfocal_transformer_hq.py @@ -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