将健身房转换为健身房。

发布于 2025-01-18 17:11:34 字数 782 浏览 4 评论 0原文

我正在尝试通过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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文