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

Why there is two position embeded in your code ? #4

Closed
machanic opened this issue Jan 30, 2018 · 3 comments
Closed

Why there is two position embeded in your code ? #4

machanic opened this issue Jan 30, 2018 · 3 comments

Comments

@machanic
Copy link

machanic commented Jan 30, 2018

one is in https://github.com/soskek/attention_is_all_you_need/blob/master/net.py#L345,
and another in https://github.com/soskek/attention_is_all_you_need/blob/master/net.py#L346-L350,
by the way, is that the calculate of sin&cos position embeded in self.initialize_position_encoding ( return the "all position encoding array"), am I correct?

@machanic machanic changed the title Why there is two position embeded in your code Why there is two position embeded in your code ? Jan 30, 2018
@soskek
Copy link
Owner

soskek commented Jan 30, 2018

embed_pos is just an option feature, which is off as default. you can ignore it.

@soskek soskek closed this as completed Jan 30, 2018
@machanic
Copy link
Author

machanic commented Jan 30, 2018

@soskek
One question about https://github.com/soskek/attention_is_all_you_need/blob/master/net.py#L345
you only add self.position_encoding_block[:, :, :length], there is no x_block or any data information pass into it? if there is two sentence with the same length, do you mean there position encoding is the same??

How to understand it?

@soskek
Copy link
Owner

soskek commented Jan 30, 2018

Check what is length. It is derived from each data given through https://github.com/soskek/attention_is_all_you_need/blob/master/net.py#L418-L419

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