We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cb57a96 commit c4b8897Copy full SHA for c4b8897
timm/models/davit.py
@@ -126,9 +126,9 @@ def forward(self, x: Tensor):
126
q, k, v = qkv.unbind(0)
127
128
k = k * self.scale
129
- attention = k.transpose(-1, -2) @ v
130
- attention = attention.softmax(dim=-1)
131
- x = (attention @ q.transpose(-1, -2)).transpose(-1, -2)
+ attn = k.transpose(-1, -2) @ v
+ attn = attn.softmax(dim=-1)
+ x = (attn @ q.transpose(-1, -2)).transpose(-1, -2)
132
x = x.transpose(1, 2).reshape(B, N, C)
133
x = self.proj(x)
134
return x
0 commit comments