Skip to content

Commit 2fa2b62

Browse files
committed
slightly more clear of einops rearrange for cls token, for #224
1 parent 9f87d1c commit 2fa2b62

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
setup(
44
name = 'vit-pytorch',
55
packages = find_packages(exclude=['examples']),
6-
version = '0.35.6',
6+
version = '0.35.7',
77
license='MIT',
88
description = 'Vision Transformer (ViT) - Pytorch',
99
long_description_content_type = 'text/markdown',

vit_pytorch/vit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def forward(self, img):
114114
x = self.to_patch_embedding(img)
115115
b, n, _ = x.shape
116116

117-
cls_tokens = repeat(self.cls_token, '1 n d -> b n d', b = b)
117+
cls_tokens = repeat(self.cls_token, '1 1 d -> b 1 d', b = b)
118118
x = torch.cat((cls_tokens, x), dim=1)
119119
x += self.pos_embedding[:, :(n + 1)]
120120
x = self.dropout(x)

0 commit comments

Comments
 (0)