Commit Graph

5 Commits

Author SHA1 Message Date
J K Terry
78d2b512d8 redo black (#2272) 2021-07-29 15:39:42 -04:00
Justin Terry
e9d2c41f2b redo black 2021-07-29 12:42:48 -04:00
Christian Clauss
bb81e141ea Blacken the codebase (#2265) 2021-07-28 20:26:34 -04:00
Melvin Wang
eee9b28882 Flattened space/point dtype mismatch (#2070)
* add test showing mismatch in flattened space dtype and flattened point dtype

* fix mismatch in flattened space dtype and flattened point dtype

* fix typo

* enhance test to detect when flattened dtype is incorrect

* fix incorrect flattened dtype

* remove inaccurate comment

* change flatten to always use space.dtype

* added testing for unflattened dtypes

* fix unflatten dtypes

* swtich flatten_space to use space.dtype for hardcoded space dtypes

* fix failure in python 3.5
2020-11-06 12:06:29 -08:00
troiganto
a8d08c041d Improve observation space of FlattenObservation wrapper (#1884)
* Add tests for gym.spaces.utils.

* Add docstrings to gym.spaces.utils.

* Remove some trailing whitespace.

* Add gym.spaces.utils.flatten_space.

The new function also is reexported as gym.spaces.flatten_space. It
improves the determination of observation_space in
gym.wrappers.FlattenObservation.

* Produce OrderedDict instead of dict in gym.spaces.unflatten().

`gym.spaces.Dict` is very particular about producing its samples as
`OrderedDict` in order preserve the order of its items. Hence,
`unflatten()` should reproduce this behavior.

* In test_utils.compare_nested, also verify order of OrderedDict items.

* Add examples to flatten_space() docstring.

* Document ``flatten(space, space.sample()) in flatten_space(space)``.

Co-authored-by: Nico Madysa <nico.madysa@tu-dresden.de>
2020-05-08 14:19:55 -07:00