Why not always project out from Attention block?
Author: fiskrtCreated Nov 19, 2024Updated Nov 22, 2024
Hey, why is the out projection from the Attention block optional? See:
https://github.com/lucidrains/vit-pytorch/blob/d47c57e32feae5c5a741a7d3baba3ac70cdb3567/vit_pytorch/vit.py#L33
In the original Attention is all you need paper there is always an out projection $W^O$ from the
Attentionblock, as given by the un-numbered equations in section 3.2.2.The projection is also always applied in the timm library: see https://github.com/huggingface/pytorch-image-models/blob/ae0737f5d098900180c4457845dda35433ab92c0/timm/models/vision_transformer.py#L105
Source: lucidrains/vit-pytorch