Check If max_episode_length is None is NPO#2193
Open
ManavR123 wants to merge 3 commits intorlworkgroup:masterfrom
Open
Check If max_episode_length is None is NPO#2193ManavR123 wants to merge 3 commits intorlworkgroup:masterfrom
ManavR123 wants to merge 3 commits intorlworkgroup:masterfrom
Conversation
ryanjulian
reviewed
Dec 4, 2020
src/garage/tf/algos/npo.py
Outdated
| self.policy = policy | ||
| self._scope = scope | ||
| self.max_episode_length = env_spec.max_episode_length | ||
| if self.max_episode_length == None: |
Member
There was a problem hiding this comment.
please place this validation above the long list of property initializations (i.e. first lines of this method), and put a newline after the if statement
ryanjulian
reviewed
Dec 4, 2020
src/garage/tf/algos/npo.py
Outdated
| self._scope = scope | ||
| self.max_episode_length = env_spec.max_episode_length | ||
| if self.max_episode_length == None: | ||
| raise ValueError("max_episode_length must not be None") |
Member
There was a problem hiding this comment.
we use single quotes in this repo. we have an automated tool called pre-commit which will check your PR for small issues like this and tell you how to fix them (or you can check the CI results below, which will also tell you what to fix).
See the guide here: https://garage.readthedocs.io/en/latest/user/preparing_a_pr.html and https://garage.readthedocs.io/en/latest/user/git_workflow.html#passing-the-pre-commit-hooks
krzentner
approved these changes
Dec 7, 2020
ryanjulian
approved these changes
Dec 7, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Address #2190
I simply add a check in NPO init to see if max_episode_length is None and if it is, I raise a ValueError.
Discussed with @ryanjulian