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

Apply Tanh activation function to ViT - MLP Head #255

Open
joeycouse opened this issue Feb 21, 2023 · 0 comments
Open

Apply Tanh activation function to ViT - MLP Head #255

joeycouse opened this issue Feb 21, 2023 · 0 comments

Comments

@joeycouse
Copy link

In the paper:

"In order to stay as close as possible to the original Transformer model, we made use of an additional
[class] token, which is taken as image representation. The output of this token is then transformed into a class prediction via a small multi-layer perceptron (MLP) with tanh as non-linearity
in the single hidden layer."

self.mlp_head = nn.Sequential(
nn.LayerNorm(dim),
nn.Linear(dim, num_classes)
)

Should there be a Tanh() function applied after the linear layer?

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

1 participant