-
Notifications
You must be signed in to change notification settings - Fork 328
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
[BugFix] patch rand_action in TransformedEnv to read the base_env method #2699
base: gh/vmoens/68/base
Are you sure you want to change the base?
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/rl/2699
Note: Links to docs will display an error until the docs builds have been completed. ❌ 4 New Failures, 7 Pending, 3 Unrelated FailuresAs of commit 2794f70 with merge base 256a700 (): NEW FAILURES - The following jobs have failed:
BROKEN TRUNK - The following jobs failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
@kurtamohler I'm not super happy with this, as the comment says it's far from accounting for transforms that do some kind of inverse mapping but the point is that without that, a transformed chess env cannot generate random actions (because the |
# env = PendulumEnv().append_transform(ActionDiscretizer(num_intervals=4)) | ||
# env.rand_action will NOT have a discrete action! | ||
# Getting a discrete action would require coding the inverse transform of an action within | ||
# ActionDiscretizer (ie, float->int, not int->float). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason we couldn't use self.action_spec.rand()
?
>>> import torchrl
>>> env = torchrl.envs.PendulumEnv().append_transform(torchrl.envs.ActionDiscretizer(num_intervals=4))
>>> env.action_spec.rand()
tensor([3])
>>> env.action_spec.rand().dtype
torch.int64
Stack from ghstack (oldest at bottom):
example_data
for NonTensor spec #2698