"git@developer.sourcefind.cn:OpenDAS/mmcv.git" did not exist on "6fc6f75a767696c1792caba1e5d8563bc8a92cef"
Unverified Commit 418d8a6f authored by Local State's avatar Local State Committed by GitHub
Browse files

fix Swin Transformer inplace mutation (#6266)



* fix inplace mutation

* Different attn shouldn't share the same attribute

* a simpler solution
Co-authored-by: default avatarYosuaMichael <yosuamichaelm@gmail.com>
parent 77940b81
...@@ -106,6 +106,7 @@ def shifted_window_attention( ...@@ -106,6 +106,7 @@ def shifted_window_attention(
x = F.pad(input, (0, 0, 0, pad_r, 0, pad_b)) x = F.pad(input, (0, 0, 0, pad_r, 0, pad_b))
_, pad_H, pad_W, _ = x.shape _, pad_H, pad_W, _ = x.shape
shift_size = shift_size.copy()
# If window size is larger than feature size, there is no need to shift window # If window size is larger than feature size, there is no need to shift window
if window_size[0] >= pad_H: if window_size[0] >= pad_H:
shift_size[0] = 0 shift_size[0] = 0
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment