Repository navigation
[BugFix] Keep real terminations on the last retained step of shifted value estimators - #4790
0xrichardlu wants to merge 1 commit into
Conversation
…value estimators _prepare_shifted_tensordict marks the last retained transition as a synthetic batch boundary by setting done=True and terminated=False. Clearing terminated also erased a real termination on that step, so TD0/TD1/TD(lambda)/GAE with shifted=True bootstrapped gamma * V(terminal state) instead of 0. Keep the original terminated flag; the boundary only needs done=True.
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/rl/4790
Note: Links to docs will display an error until the docs builds have been completed.
|
|
Hi @0xrichardlu! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
|
Thanks! I’ve signed the individual CLA. Please let me know if anything else is needed. |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Description
With
shifted=True,_prepare_shifted_tensordictmarks the last retained transition as a synthetic boundary by settingdone=Trueandterminated=False. Clearingterminatedalso erased a real termination on that step, soTD0Estimator/TD1Estimator/TDLambdaEstimator/GAEbootstrappedgamma * V(terminal state)there instead of 0, and GAE carried the error backwards through the episode. This keeps the originalterminatedflag; the boundary only needsdone=True. The test reference_shifted_referencehad the same overwrite and is fixed too. A new parametrized test covers a real termination on the last retained step for all four estimators.Motivation and Context
close #4789
Types of changes
Checklist