未调用GoalEnv子类重置

问题描述 投票:0回答:1

试图从GoalEnv派生出env。

有谁知道为什么从未调用这个reset函数?

def reset(self):
        # Enforce that each GoalEnv uses a Goal-compatible observation space.
        if not isinstance(self.observation_space, gym.spaces.Dict):
            raise error.Error('GoalEnv requires an observation space of type gym.spaces.Dict')
        result = super(GoalEnv, self).reset()
        for key in ['observation', 'achieved_goal', 'desired_goal']:
            if key not in result:
                raise error.Error('GoalEnv requires the "{}" key to be part of the observation dictionary.'.format(key))
        return result

如果我从GoalEnv派生自己的env,则永远不会调用基本重置 - 因此它永远不会检查observation_space。

有没有这个实际调用的例子?

我尝试在重置时调用它:

super(MyEnv, self).reset

但只是得到了NotImplementedError

python openai-gym
1个回答
0
投票

这是因为当你在reset上通过super调用MyEnv时,你实际上是在调用GoalEnv.reset,后者又调用引发super(GoalEnv, self).reset()NotImplementedError。我认为你不应该像那样调用那种重置方法。

© www.soinside.com 2019 - 2024. All rights reserved.