fix value residual

This commit is contained in:
Phil Wang
2024-10-31 06:48:24 -07:00
parent 0b5c9b4559
commit 141239ca86
2 changed files with 2 additions and 2 deletions

View File

@@ -6,7 +6,7 @@ with open('README.md') as f:
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,

View File

@@ -57,7 +57,7 @@ class Attention(Module):
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