Skip to content

Commit

Permalink
Merge pull request #15 from NVlabs/dev2
Browse files Browse the repository at this point in the history
update fastervit model
  • Loading branch information
ahatamiz authored Jun 19, 2023
2 parents 3e296db + 3d1bce2 commit b2170fd
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 4 deletions.
2 changes: 0 additions & 2 deletions fastervit/models/faster_vit.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,9 +573,7 @@ def forward(self, x):
qkv = self.qkv(x).reshape(B, -1, 3, self.num_heads, C // self.num_heads).permute(2, 0, 3, 1, 4)
q, k, v = qkv[0], qkv[1], qkv[2]
attn = (q @ k.transpose(-2, -1)) * self.scale

attn = self.pos_emb_funct(attn, self.resolution ** 2)

attn = attn.softmax(dim=-1)
attn = self.attn_drop(attn)
x = (attn @ v).transpose(1, 2).reshape(B, -1, C)
Expand Down
2 changes: 0 additions & 2 deletions fastervit/models/faster_vit_any_res.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,9 +573,7 @@ def forward(self, x):
qkv = self.qkv(x).reshape(B, -1, 3, self.num_heads, C // self.num_heads).permute(2, 0, 3, 1, 4)
q, k, v = qkv[0], qkv[1], qkv[2]
attn = (q @ k.transpose(-2, -1)) * self.scale

attn = self.pos_emb_funct(attn, self.resolution ** 2)

attn = attn.softmax(dim=-1)
attn = self.attn_drop(attn)
x = (attn @ v).transpose(1, 2).reshape(B, -1, C)
Expand Down

0 comments on commit b2170fd

Please sign in to comment.