Update metaformers.py

This commit is contained in:
Fredo Guan 2023-01-18 12:03:11 -08:00
parent 3c6821cc12
commit 9efb706b25

View File

@ -180,6 +180,7 @@ class RandomMixing(nn.Module):
requires_grad=False)
def forward(self, x):
B, C, H, W = x.shape
print(H*W)
x = x.reshape(B, H*W, C)
x = torch.einsum('mn, bnc -> bmc', self.random_matrix, x)
x = x.reshape(B, C, H, W)