mirror of
https://github.com/lucidrains/vit-pytorch.git
synced 2025-12-30 08:02:29 +00:00
norm not needed when reusing attention in lookvit
This commit is contained in:
2
setup.py
2
setup.py
@@ -6,7 +6,7 @@ with open('README.md') as f:
|
|||||||
setup(
|
setup(
|
||||||
name = 'vit-pytorch',
|
name = 'vit-pytorch',
|
||||||
packages = find_packages(exclude=['examples']),
|
packages = find_packages(exclude=['examples']),
|
||||||
version = '1.7.1',
|
version = '1.7.2',
|
||||||
license='MIT',
|
license='MIT',
|
||||||
description = 'Vision Transformer (ViT) - Pytorch',
|
description = 'Vision Transformer (ViT) - Pytorch',
|
||||||
long_description=long_description,
|
long_description=long_description,
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ class Attention(Module):
|
|||||||
|
|
||||||
self.split_heads = Rearrange('b n (h d) -> b h n d', h = heads)
|
self.split_heads = Rearrange('b n (h d) -> b h n d', h = heads)
|
||||||
|
|
||||||
self.norm = LayerNorm(dim)
|
self.norm = LayerNorm(dim) if not reuse_attention else nn.Identity()
|
||||||
self.attend = nn.Softmax(dim = -1)
|
self.attend = nn.Softmax(dim = -1)
|
||||||
self.dropout = nn.Dropout(dropout)
|
self.dropout = nn.Dropout(dropout)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user