-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Description
Should the matrix multiplication not be swapped?
I think the dimension don`t work for the original equation because you are multiplying a
class RandomMixing(nn.Module):
def __init__(self, num_tokens=196, **kwargs):
super().__init__()
self.random_matrix = nn.parameter.Parameter(
data=torch.softmax(torch.rand(num_tokens, num_tokens), dim=-1),
requires_grad=False)
def forward(self, x):
B, H, W, C = x.shape
x = x.reshape(B, H*W, C)
x = torch.einsum('mn, bnc -> bmc', self.random_matrix, x)
x = x.reshape(B, H, W, C)
return xMetadata
Metadata
Assignees
Labels
No labels