将健身房转换为健身房。
我正在尝试通过Gym Openai的一些测试床实现Q学习算法,并试图转换一些空间,因为不同的环境具有不同的动作和观察空间。我知道包装纸的存在,但找不到适合我的用例的合适的包装器。我尝试使用
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
但也没有帮助,我尝试了称为Flatten空间的包装器,但它使用了相同的功能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'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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论