Support Tuple and Dict spaces
See original GitHub issueIf the obs_space
of an environment is a spaces.Tuple
, then DummyVecEnc
breaks.
class DummyVecEnv(VecEnv):
def __init__(self, env_fns):
self.envs = [fn() for fn in env_fns]
env = self.envs[0]
VecEnv.__init__(self, len(env_fns), env.observation_space, env.action_space)
obs_space = env.observation_space
self.keys, shapes, dtypes = obs_space_info(obs_space)
self.buf_obs = { k: np.zeros((self.num_envs,) + tuple(shapes[k]), dtype=dtypes[k]) for k in self.keys }
This breaks because self.keys
is None
. This happens when obs_space
is spaces.Tuple
, given that spaces.Tuple
is not instance of spaces.Dict
, and therefore obs_space_info
returns [None], {None: None}, {None: None}
.
So, I’m not sure how to use the DummyVecEnv now…
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Choosing between List, Tuple and Dictionary - Medium
List, Tuple and Dictionary are three of the popular data structures that are used by beginners to advanced programmers to store data.
Read more >Functions with Tuples and Dictionaries Mixed-Up Code ...
Create a function called dict_to_tup_of_tuples that takes in dictionary as a parameter and returns a tuple that contains tuples with the first value...
Read more >How to use the gym.spaces.Dict function in gym - Snyk
To help you get started, we've selected a few gym examples, based on popular ways it is used in public projects. Secure your...
Read more >Differences and Applications of List, Tuple, Set and Dictionary ...
Tuple : A Tuple is a collection of Python objects separated by commas. In some ways, a tuple is similar to a list...
Read more >compiler_gym.spaces — CompilerGym 0.2.5 documentation
Additional spaces: Commandline. Dict. Discrete. NamedDiscrete. Permutation. Reward. Scalar. SpaceSequence. Sequence. Tuple ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Alright,
spaces.Dict
are also not supported. I’ve patched it. If anyone is interested, here’s my patch.https://github.com/Atcold/baselines/commit/dbc329f28c968fc261f53ebafc9f53192caf967c
https://github.com/openai/baselines/pull/911 patches this for Tuples