[Enhance] Improve CPE performance by reduce memory copy. (#762)

pull/776/head
XiaobingZhang 2022-04-02 11:12:20 +08:00 committed by GitHub
parent 4a3f8d02c5
commit 875195efe9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -32,7 +32,7 @@ class ConditionalPositionEncoding(BaseModule):
H, W = hw_shape
feat_token = x
# convert (B, N, C) to (B, C, H, W)
cnn_feat = feat_token.transpose(1, 2).view(B, C, H, W)
cnn_feat = feat_token.transpose(1, 2).view(B, C, H, W).contiguous()
if self.stride == 1:
x = self.proj(cnn_feat) + cnn_feat
else: