Linear Embedding:
| 7 | |
| 8 | |
| 9 | class MLP(nn.Module): |
| 10 | """ |
| 11 | Linear Embedding: |
| 12 | """ |
| 13 | |
| 14 | def __init__(self, input_dim=2048, embed_dim=768): |
| 15 | super().__init__() |
| 16 | self.proj = nn.Linear(input_dim, embed_dim) |
| 17 | |
| 18 | def forward(self, x): |
| 19 | x = x.flatten(2).transpose(1, 2) |
| 20 | x = self.proj(x) |
| 21 | return x |
| 22 | |
| 23 | |
| 24 | class DecoderHead(nn.Module): |