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

CharLMMinibatchLoader.lua, Line 39 Question #7

Open
techutechu opened this issue Jul 24, 2016 · 0 comments
Open

CharLMMinibatchLoader.lua, Line 39 Question #7

techutechu opened this issue Jul 24, 2016 · 0 comments

Comments

@techutechu
Copy link

I have a question about Line 39: ydata[-1] = data[1]

The key here is to shift x's (input characters) by one character forward to get y's (target characters we want to predict based on x's given). So Line 38 makes perfect sense to me:

ydata:sub(1,-2):copy(data:sub(2,-1)).

However, why do we want to assign the very first character in the given text to the last element of ydata? We certainly do not want to predict the first character of the text, right? It would make sense if the final element of ydata was instead the actual next character in the text in case our number of characters is not divisible by (seq_length times batch_size). But it looks that the code just cuts off the remaining characters if any.

Could anyone help me to make sense of this? Maybe I am completely misunderstanding the code. Thank you in advance.

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