Skip to content
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

Fix out of date assertation message for pad_observation_v0 in markov_vector_wrappers #173

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions supersuit/vector/concat_vec_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ def reset(self, seed=None, return_info=False, options=None):
_res_obs.append(_obs)
_res_info.append(_info)

return self.concat_obs(_res_obs), sum(_res_info, [])
info_array = {}
for i, info in enumerate(_res_info):
info_array = self._add_info(info_array, info, i)

return self.concat_obs(_res_obs), info_array

def concat_obs(self, observations):
return concatenate(
Expand Down Expand Up @@ -105,8 +109,12 @@ def step(self, actions):
observations = self.concat_obs(observations)
rewards = np.concatenate(rewards, axis=0)
dones = np.concatenate(dones, axis=0)
infos = sum(infos, [])
return observations, rewards, dones, infos

info_array = {}
for i, info in enumerate(infos):
info_array = self._add_info(info_array, info[0], i)

return observations, rewards, dones, info_array

def render(self, mode="human"):
return self.vec_envs[0].render(mode)
Expand Down
4 changes: 2 additions & 2 deletions supersuit/vector/markov_vector_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ def __init__(self, par_env, black_death=False):
assert all(
self.observation_space == par_env.observation_space(agent)
for agent in par_env.possible_agents
), "observation spaces not consistent. Perhaps you should wrap with `supersuit.aec_wrappers.pad_observations`?"
), "observation spaces not consistent. Perhaps you should wrap with `supersuit.multiagent_wrappers.pad_observations_v0`?"
assert all(
self.action_space == par_env.action_space(agent)
for agent in par_env.possible_agents
), "action spaces not consistent. Perhaps you should wrap with `supersuit.aec_wrappers.pad_actions`?"
), "action spaces not consistent. Perhaps you should wrap with `supersuit.multiagent_wrappers.pad_observations_v0`?"
self.num_envs = len(par_env.possible_agents)
self.black_death = black_death

Expand Down