mirror of
https://github.com/huggingface/pytorch-image-models.git
synced 2025-06-03 15:01:08 +08:00
attention -> attn in davit for model consistency
This commit is contained in:
parent
cb57a96862
commit
c4b8897e9e
@ -126,9 +126,9 @@ class ChannelAttention(nn.Module):
|
|||||||
q, k, v = qkv.unbind(0)
|
q, k, v = qkv.unbind(0)
|
||||||
|
|
||||||
k = k * self.scale
|
k = k * self.scale
|
||||||
attention = k.transpose(-1, -2) @ v
|
attn = k.transpose(-1, -2) @ v
|
||||||
attention = attention.softmax(dim=-1)
|
attn = attn.softmax(dim=-1)
|
||||||
x = (attention @ q.transpose(-1, -2)).transpose(-1, -2)
|
x = (attn @ q.transpose(-1, -2)).transpose(-1, -2)
|
||||||
x = x.transpose(1, 2).reshape(B, N, C)
|
x = x.transpose(1, 2).reshape(B, N, C)
|
||||||
x = self.proj(x)
|
x = self.proj(x)
|
||||||
return x
|
return x
|
||||||
|
Loading…
x
Reference in New Issue
Block a user