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

Remove reset_buffer() from reset method #501

Merged
merged 6 commits into from
Jan 13, 2022

Conversation

Markus28
Copy link
Collaborator

  • I have marked all applicable categories:
    • exception-raising fix
    • algorithm implementation fix
    • documentation modification
    • new feature
  • I have reformatted the code using make format (required)
  • I have checked the code using make commit-checks (required)
  • If applicable, I have mentioned the relevant/related issue(s)
  • If applicable, I have listed every items in this Pull Request below

This pull request:

  • Removes self.reset_buffer() from the reset() method
  • Points out this change in the documentation

This was discussed in #500

Best, Markus

@Markus28
Copy link
Collaborator Author

So there are at least two tests (test_sac_with_il and test_collector_nepisode) that break because they assume that reset also resets the buffer. I can adapt those to use collector.reset_buffer() along with collector.reset(). But indeed, this seems to be a breaking change in many cases.
Not sure why the type check fails.

@Trinkle23897 Trinkle23897 linked an issue Jan 11, 2022 that may be closed by this pull request
8 tasks
@Trinkle23897
Copy link
Collaborator

Not sure why the type check fails.

I can do for that

What would you think about adding a keyword argument reset_buffer=True to Collector.init?
So there are at least two tests (test_sac_with_il and test_collector_nepisode) that break because they assume that reset also resets the buffer.

Indeed, but they all call collector.reset(), so why not change the signature to

collector.reset(reset_buffer: bool = True)

and in init:

def __init__(...):
  ...
  self.reset(reset_buffer=False)

@codecov-commenter
Copy link

codecov-commenter commented Jan 12, 2022

Codecov Report

Merging #501 (90a1554) into master (3592f45) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #501   +/-   ##
=======================================
  Coverage   94.11%   94.11%           
=======================================
  Files          61       61           
  Lines        4058     4059    +1     
=======================================
+ Hits         3819     3820    +1     
  Misses        239      239           
Flag Coverage Δ
unittests 94.11% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
tianshou/data/buffer/base.py 99.42% <100.00%> (ø)
tianshou/data/collector.py 95.58% <100.00%> (+0.01%) ⬆️
tianshou/utils/net/continuous.py 96.52% <100.00%> (ø)
tianshou/utils/net/discrete.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3592f45...90a1554. Read the comment docs.

@Trinkle23897 Trinkle23897 merged commit a2d76d1 into thu-ml:master Jan 13, 2022
BFAnas pushed a commit to BFAnas/tianshou that referenced this pull request May 5, 2024
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.

Loading ReplayBuffer checkpoint into Collector
3 participants