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

nn.Embedding layer initialization #63

Open
ivanstepanovftw opened this issue Feb 7, 2024 · 0 comments
Open

nn.Embedding layer initialization #63

ivanstepanovftw opened this issue Feb 7, 2024 · 0 comments

Comments

@ivanstepanovftw
Copy link

I have a questions regarding nn.Embedding layer. It is a layer that mimics F.one_hot + nn.Linear(..., bias=False) and implemented as a lookup table, a magnitude faster than one hot + linear combination.

By default, nn.Embedding is initialized as a normal distribution (mean 0, std 1). However, first layer of SIREN expects uniform distributed input at interval [-1, 1].

  1. Should I initialize nn.Embedding as embedding.weight.uniform_(-1, 1) to match expectations of SIREN for input distributions?
  2. Can I use nn.Embedding as a first layer of SIREN, and initialize it as proposed - embedding.weight.uniform_(-1 / in_features, 1 / in_features) - to get rid of two linear layers without non-linearity in between?
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