-
Notifications
You must be signed in to change notification settings - Fork 8.6k
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
Changed .shape to be a property #2397
Conversation
I'm slightly confused by the tests failing, it worked on my fork, and the error seems to happen in some seemingly unrelated video recording tests. |
Yep, @vwxyzjn needs to fix a flakey test he accidentally added. He said he'll do it in the morning |
I'm probably missing something, but how does your PR resolve this from Ananth's issue?
|
So what Ananth originally proposed was changing So in particular, with that approach the behavior of a Discrete space doesn't change, i.e. you have the same problem there (you can do Instead, I handled it for all spaces by turning As far as I can tell, the only differences this makes are:
My reasons:
tl;dr Ananth's version was specific, and needed a general guard to make sure it doesn't break/affect other spaces. My version is general, so other spaces are automatically affected (fixed?), so that guard is not necessary. |
@RedTachyon I think the tests will pass once #2394 is merged , test is fixed there |
This PR (and gym 0.20 release) breaks all SB3 pre-trained models 😕 🤕 (and all pickled Spaces), to be backward compatible you have to patch |
In relation to issue #1880, it's similar (but not exactly the same) as what the OP there suggested. Basically the shape is now stored as
self._shape
, and has a@property
-based getter. There is no setter, as changing the shape might also require changinglow
andhigh
, and at that point it's probably better to just create a new object.It shouldn't change the behavior at all, except that there's an exception thrown if someone tries to manually change
self.shape
.I opted for a
_name
naming because dunder methods (as suggested by OP) are typically reserved for other stuff.It'd be good if there's another set of eyes to see if it for sure doesn't break anything. It's simple enough, and the tests (should) pass, but