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

the __getitem__ code delivers (batch_size + 1) results, not (batch_size) #6

Closed
drmatthewclark opened this issue Oct 3, 2020 · 2 comments

Comments

@drmatthewclark
Copy link

the line in getitem in the generator

indexes = self.indexes[index*self.batch_size:(index+1)*self.batch_size]

returns batch_size +1 results. E.g. if batch_size is 10, when index is 0 it returns indices 0 through 10, which is 11 items. If batch_size is 1, it returns item 0 and 1 etc. Therefore it will overflow when batch_size is an even multiple of the row count.

The correct code is:

 indexes = self.indexes[index*self.batch_size:((index+1)*self.batch_size)-1]
@drmatthewclark
Copy link
Author

this is important because your code is good for training on writing generators.

@drmatthewclark
Copy link
Author

mistake in python syntax

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