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

Wrong number of elements when creating minibatchlist #2

Open
araffin opened this issue May 25, 2018 · 0 comments
Open

Wrong number of elements when creating minibatchlist #2

araffin opened this issue May 25, 2018 · 0 comments

Comments

@araffin
Copy link

araffin commented May 25, 2018

Hello,

It seems that when creating the minibatchlist (main.py#L121), the wrong total number of element is used (because all last observation of each episode is removed):

minibatchlist = [np.array(sorted(indices[start_idx:start_idx + self.batchsize]))
                for start_idx in range(0, num_samples - self.batchsize + 1, self.batchsize)]

indices has not a length of num_samples, so instead of num_samples - self.batchsize + 1, it should be len(indices) - self.batchsize + 1:

minibatchlist = [np.array(sorted(indices[start_idx:start_idx + self.batch_size]))
                 for start_idx in range(0, len(indices) - self.batchsize + 1, self.batch_size)]

In fact, the current code always works when we have num_episodes < batchsize, but breaks when we have a lot of episodes ( num_episodes > 2 * batchsize).

this bug was spotted by @Elovir and @hill-a

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