attention -> attn in davit for model consistency

This commit is contained in:
Ross Wightman 2024-05-04 14:06:11 -07:00
parent cb57a96862
commit c4b8897e9e

View File

@ -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