Skip to content

Commit

Permalink
fix value residual
Browse files Browse the repository at this point in the history
  • Loading branch information
lucidrains committed Oct 31, 2024
1 parent 0b5c9b4 commit 141239c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
setup(
name = 'vit-pytorch',
packages = find_packages(exclude=['examples']),
version = '1.8.6',
version = '1.8.7',
license='MIT',
description = 'Vision Transformer (ViT) - Pytorch',
long_description=long_description,
Expand Down
2 changes: 1 addition & 1 deletion vit_pytorch/simple_vit_with_value_residual.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def forward(self, x, value_residual = None):
q, k, v = map(lambda t: rearrange(t, 'b n (h d) -> b h n d', h = self.heads), qkv)

if exists(value_residual):
v = v + value_residual
v = 0.5 * (v + value_residual)

dots = torch.matmul(q, k.transpose(-1, -2)) * self.scale

Expand Down

0 comments on commit 141239c

Please sign in to comment.