Update metaformers.py

pull/1647/head
Fredo Guan 2 years ago
parent 53f992723c
commit 9a415a6041

@ -180,7 +180,7 @@ class RandomMixing(nn.Module):
data=torch.softmax(torch.rand(num_tokens, num_tokens), dim=-1), data=torch.softmax(torch.rand(num_tokens, num_tokens), dim=-1),
requires_grad=False) requires_grad=False)
''' '''
self.random_matrix = torch.softmax(torch.rand(num_tokens, num_tokens) self.random_matrix = torch.softmax(torch.rand(num_tokens, num_tokens))
def forward(self, x): def forward(self, x):
B, H, W, C = x.shape B, H, W, C = x.shape
x = x.reshape(B, H*W, C) x = x.reshape(B, H*W, C)

Loading…
Cancel
Save