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

observation_space return None #592

Open
izvvv opened this issue Apr 15, 2024 · 1 comment
Open

observation_space return None #592

izvvv opened this issue Apr 15, 2024 · 1 comment

Comments

@izvvv
Copy link

izvvv commented Apr 15, 2024

state_dim = env.observation_space.shape[0]
action_dim = env.action_space.shape[0]
max_action = float(env.action_space.high[0])

parking-v0
env.observation_space.shape return none lead to error
how to deal with it?

@eleurent
Copy link
Collaborator

This is because for ParkingEnv is compatible with training with HER (Hindsight Experience Replay), which requires it to be (see first warning) a gym.GoalEnv, and GoalEnv environments use Dict as observation spaces, not Boxes/arrays, so env.observation.space.shape wont work, you first need to get its fields, and then get their shape.

For example,

print(env.observation_space['observation'].shape)
print(env.observation_space['achieved_goal'].shape)
print(env.observation_space['desired_goal'].shape)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants