Skip to content

Commit

Permalink
[Enhance] Improve CPE performance by reduce memory copy. (open-mmlab#762
Browse files Browse the repository at this point in the history
)
  • Loading branch information
XiaobingSuper authored Apr 2, 2022
1 parent 8e2f05b commit 2473813
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mmcls/models/utils/position_encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def forward(self, x, hw_shape):
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:
Expand Down

0 comments on commit 2473813

Please sign in to comment.