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

Linear layer adds bias term #5

Open
zadaianchuk opened this issue Aug 3, 2020 · 2 comments
Open

Linear layer adds bias term #5

zadaianchuk opened this issue Aug 3, 2020 · 2 comments

Comments

@zadaianchuk
Copy link

zadaianchuk commented Aug 3, 2020

self.key = nn.Linear(input_size, num_input_heads * input_query_size).to(self.device)
self.value = nn.Linear(input_size, num_input_heads * input_value_size).to(self.device)

The linear layer adds bias term by default, however, in formula 4 of the paper, it is no bias term. Is this intended? Or should I use

self.key = nn.Linear(input_size, num_input_heads * input_query_size, bias=False).to(self.device)
self.value = nn.Linear(input_size, num_input_heads * input_value_size, bias=False).to(self.device)
@dido1998
Copy link
Owner

dido1998 commented Aug 5, 2020

Hi, I was able to get similar results as the paper with the bias term added so I don't think it makes that much difference. To exactly match the official implementation, these linear layers should be implemented using group operations, For example, see https://github.com/anirudh9119/RIMs/blob/master/event_based/attention.py#L111.

@pvsnp9
Copy link

pvsnp9 commented Jun 10, 2021

In GroupLSTM cell, you have used GroupLinear as Linear Layer that does not use bias. Is there any reason that you choose not to use bias in grouped LSTMCells or grouped GRUCell ?

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

3 participants