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

Using droplast=True in DataLoaders #37

Open
xamm opened this issue May 4, 2021 · 2 comments
Open

Using droplast=True in DataLoaders #37

xamm opened this issue May 4, 2021 · 2 comments

Comments

@xamm
Copy link

xamm commented May 4, 2021

Currently, an error occurs when the epoch_size argument is not an integer multiple of batchsize.

assert opts.epoch_size % opts.batch_size == 0, "Epoch size must be integer multiple of batch size!"

I assume this is to ensure that there is no batch with less than the batchsize amount of data samples.

Is there any reason not to use the droplast parameter in DataLoaders to throw away such batches instead of generating an error?

@wouterkool
Copy link
Owner

Hi!

I don't think there would be a big problem with your suggestion, except that a very small batch could theoretically yield a noisy gradient. Please try and let me know if you run into problems.

@xamm
Copy link
Author

xamm commented May 22, 2021

It seems, that simply adding drop_last=True does not work as this assert

assert (len(self.dataset) == len(self.baseline))

fails after the change.

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