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

Fix NStepBatchSampler sampling out of bounds indicies #74

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ludvigk
Copy link

@ludvigk ludvigk commented Sep 13, 2024

When stacksize > 1, NStepBatchSampler samples inds < stacksize, which causes out of bounds errors.

Copy link

codecov bot commented Sep 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.23%. Comparing base (29a6a3e) to head (4faf656).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #74   +/-   ##
=======================================
  Coverage   74.23%   74.23%           
=======================================
  Files          18       18           
  Lines         850      850           
=======================================
  Hits          631      631           
  Misses        219      219           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jeremiahpslewis
Copy link
Member

@ludvigk Thanks! Can you please add a test that confirms the fix works?

@ludvigk
Copy link
Author

ludvigk commented Sep 27, 2024

When updating the test it seemed to me as if the episode buffer has a size of capacity + 2. After pushing 12 or more states to the buffer with capacity 10, valid_range returns an array with 12 elements instead of 11. I'm not 100% sure where the extra +1 comes from though.

Clearly I broke something else, so my "fix" was not correct.

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

Successfully merging this pull request may close these issues.

2 participants