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

Not found LayerNorm in FeedForward module and Attention module #8

Open
CSLujunyu opened this issue May 31, 2021 · 1 comment
Open

Comments

@CSLujunyu
Copy link

As the paper described, LayerNorm layer are added to FeedForward module and Attention module. But I can't find it in this project.

image
image

Is it something wrong?

@enhuiz
Copy link

enhuiz commented Oct 28, 2021

They are here:

class PreNorm(nn.Module):
def __init__(self, dim, fn):
super().__init__()
self.fn = fn
self.norm = nn.LayerNorm(dim)
def forward(self, x, **kwargs):
x = self.norm(x)
return self.fn(x, **kwargs)

and

self.attn = PreNorm(dim, self.attn)
self.ff1 = Scale(0.5, PreNorm(dim, self.ff1))
self.ff2 = Scale(0.5, PreNorm(dim, self.ff2))

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

2 participants