From 1fa1e01646092da9f756601467513d103192af2d Mon Sep 17 00:00:00 2001 From: Fredo Guan Date: Thu, 8 Dec 2022 17:43:35 -0800 Subject: [PATCH] Update davit.py --- timm/models/davit.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/timm/models/davit.py b/timm/models/davit.py index dab88d32..46a97648 100644 --- a/timm/models/davit.py +++ b/timm/models/davit.py @@ -224,7 +224,11 @@ def window_reverse(windows : Tensor, window_size: int, H: int, W: int): window_size, window_size, -1) - x = x.permute(0, 1, 3, 2, 4, 5).contiguous().view(B, H, W, -1) + x = x.permute(0, 1, 3, 2, 4, 5).contiguous().view( + torch.floor(torch.tensor(windows.size(dim=0)) / (H * W / window_size / window_size)).int().item(), + H, + W, + -1) return x