1

I'm trying to implement Q Learning algorithm over some of the test beds in gym OpenAI and was trying to convert some of the space since different environment have different action and observation spaces. I'm aware of the existence of wrappers but couldn't find the right one for my use case. I tried using

from gym.spaces.utils import flatten_space
# FLATTEN AND CHECK IF THE ENVIRONMENT SPACE IS NOW DISCRETE
assert flatten_space(env.observation_space)
env.observation_space

And that didn't help either, I tried the wrapper called flatten space but it uses the same function flatten_space.

class FlattenObservation(ObservationWrapper):
    r"""Observation wrapper that flattens the observation."""

    def __init__(self, env):
        super().__init__(env)
        self.observation_space = spaces.flatten_space(env.observation_space)

    def observation(self, observation):
        return spaces.flatten(self.env.observation_space, observation)

I was wondering if anyone can help me convert discrete to box, or vice versa!

Thanks.

Manu Dwivedi
  • 87
  • 1
  • 4

0 Answers0