openai / gym

A toolkit for developing and comparing reinforcement learning algorithms.
https://www.gymlibrary.dev
Other
34.31k stars 8.59k forks source link

use Dict or Tuple, the code is [here](https://github.com/openai/gym/blob/master/gym/spaces/dict_space.py). #3199

Open pericles01 opened 1 year ago

pericles01 commented 1 year ago
          use Dict or Tuple, the code is [here](https://github.com/openai/gym/blob/master/gym/spaces/dict_space.py).

Originally posted by @yangpeiren in https://github.com/openai/gym/issues/593#issuecomment-448345762

I've used a Dict but the call of observation_space.shape returns None. With this none value I can't use tensorflow reinforcement learning algorithms. How can I handle the problem please? PS: I also use a custom gym env shown on this tutorial: https://www.gymlibrary.dev/content/environment_creation/

pseudo-rnd-thoughts commented 1 year ago

You will most likely need to flatten the observation, use the FlattenObservation wrapper to achieve this easily. This should give you a Box space that will have a shape