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

Move residual connections from SequenceLabeler to the encoders #789

Open
varisd opened this issue Feb 5, 2019 · 1 comment
Open

Move residual connections from SequenceLabeler to the encoders #789

varisd opened this issue Feb 5, 2019 · 1 comment

Comments

@varisd
Copy link
Member

varisd commented Feb 5, 2019

Should the residual connections be really handled inside the SequenceLabeler? Shouldn't the underlying encoder be in charge of that?

Right now, the labeler creates two matrices, enc_out_proj_M and enc_in_proj_M to project both encoder output states and input sequence to the output vocabulary (to later compute the distribution from the logits).
So, to get the logits, we compute (enc_out_proj_M * enc_out) + (enc_in_proj_M * enc_in).

If we handle the residual connections in the encoder (optional for the encoder) we can reduce the computation to a single matrix multiplication (enc_out + enc_in) * enc_out_proj_M. This would also simplify the code of the SequenceLabeler and allow us to use any TemporalStateful object as an input (instead of current list of RecurrentEncoder, SentenceEncoder).

This change should not change the gradient flow during training or am I missing something?

@jlibovicky
Copy link
Contributor

To vskutečnosti není residual connection, protože je tam navíc projekce, residual connection by byl jenom součet. Dřív se tomu říkalo skip-connection, dneska se tomu občas dense connection podle DenseNetu. Už to mám v nějaký věvi vyrefaktorovaný pryč. Udělám PR, až se dodělá tf.dataset.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants