Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shape related question #55

Open
SKevin673 opened this issue May 1, 2024 · 0 comments
Open

shape related question #55

SKevin673 opened this issue May 1, 2024 · 0 comments

Comments

@SKevin673
Copy link

According to code in detection\denseclip\models.py#525 to #532

x = x.permute(1, 0, 2)  # NLD -> LND

features = []
for i, blk in enumerate(self.transformer.resblocks):
    x = blk(x)
    if i in self.out_indices:
        xp = x[:, 1:, :].permute(0, 2, 1).reshape(B, -1, H, W)
        features.append(xp.contiguous())

and code in detection\denseclip\models.py#322

self.attn = nn.MultiheadAttention(d_model, n_head)

batch_first is not initialized(so it should be False as default) when defining self.attn in class ResidualAttentionBlock.
Question: Why the shape of x is (B, H*W+1, C) so that the shape of xp can be (B, C, H, W)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant