question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CustomEnv Observation Shape Error

See original GitHub issue

I am running into small issue with my observation space shape

        self.observation_space = spaces.Box(low=-np.inf, high=np.inf,shape=(6,),
                                           dtype=np.float32)

What do i need to modify to fix this issue.

Error with check_env is

AssertionError: The observation returned by the reset()method does not match the given observation space

Without check_env ValueError: Cannot feed value of shape (1, 14) for Tensor 'input/Ob:0', which has shape '(?, 6)'

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:19

github_iconTop GitHub Comments

7reactions
GF-Huangcommented, Jul 14, 2022

I had try return np.array([0.0, 0.0]) but not work. But dtype=np.float64 works.

2reactions
GF-Huangcommented, Jul 14, 2022

Thanks your tips, I found that add dtype solved, but why?

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error while defining observation space in gym custom ...
When you define custom env in gym, check_env checks several things. In this case, observation.isinstance(observation_space) is not passed.
Read more >
Vectorized Environments - Stable Baselines - Read the Docs
In the case of non-array observation spaces such as Dict or Tuple , where different sub-spaces may have different shapes, the sub-observations are...
Read more >
Stable Baselines3 Tutorial - Creating a custom Gym ...
First steps with the gym interface · observation_space which one of the gym spaces ( Discrete , Box , ...) and describe the...
Read more >
Stable Baselines Documentation - Read the Docs
always normalize your observation space when you can, i.e., ... Verifies the tensors match the given shape, will raise an error if the ......
Read more >
[RL] Create Environment 만들 때 참고 - All I Need Is Data.
super(CustomEnv, self).__init__() # Define action and observation space # They must be gym.spaces objects # Example when using discrete ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found