当前位置: 首页>>代码示例>>Python>>正文


Python gym.RewardWrapper方法代码示例

本文整理汇总了Python中gym.RewardWrapper方法的典型用法代码示例。如果您正苦于以下问题:Python gym.RewardWrapper方法的具体用法?Python gym.RewardWrapper怎么用?Python gym.RewardWrapper使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gym的用法示例。


在下文中一共展示了gym.RewardWrapper方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _render

# 需要导入模块: import gym [as 别名]
# 或者: from gym import RewardWrapper [as 别名]
def _render(self, mode='human', close=False):
        if close:
            return
        if mode == 'human':
            from gym.envs.classic_control import rendering
            if self.viewer is None:
                self.viewer = rendering.SimpleImageViewer()
            self.viewer.imshow(np.max(np.stack(self._obs_buffer), axis=0))
            return np.max(np.stack(self._obs_buffer), axis=0)
        else:
            return np.max(np.stack(self._obs_buffer), axis=0)

# class ClipRewardEnv(gym.RewardWrapper):
#     def _reward(self, reward):
#         """Bin reward to {+1, 0, -1} by its sign."""
#         return np.sign(reward) 
开发者ID:uber-research,项目名称:ape-x,代码行数:18,代码来源:atari_wrappers.py

示例2: __init__

# 需要导入模块: import gym [as 别名]
# 或者: from gym import RewardWrapper [as 别名]
def __init__(self, env):
        gym.RewardWrapper.__init__(self, env) 
开发者ID:Hwhitetooth,项目名称:lirpg,代码行数:4,代码来源:atari_wrappers.py

示例3: __init__

# 需要导入模块: import gym [as 别名]
# 或者: from gym import RewardWrapper [as 别名]
def __init__(self, env, scale):
        gym.RewardWrapper.__init__(self, env)
        self.scale = scale 
开发者ID:MaxSobolMark,项目名称:HardRLWithYoutube,代码行数:5,代码来源:run_humanoid.py

示例4: __init__

# 需要导入模块: import gym [as 别名]
# 或者: from gym import RewardWrapper [as 别名]
def __init__(self, env: gym.Env, reward_function: BaseRewardFunction):
        """

        Parameters
        ----------
        env: gym.Env
            A gym environment (potentially already wrapped).
        reward_function: BaseRewardFunction
            The reward function to be used instead of the original reward.
        """
        super(RewardWrapper, self).__init__(env)
        self.reward_function = reward_function
        self.current_state = None

    # pylint: disable=method-hidden 
开发者ID:JohannesHeidecke,项目名称:irl-benchmark,代码行数:17,代码来源:reward_wrapper.py

示例5: __init__

# 需要导入模块: import gym [as 别名]
# 或者: from gym import RewardWrapper [as 别名]
def __init__(self, env):
        """
        clips the reward to {+1, 0, -1} by its sign.

        :param env: (Gym Environment) the environment
        """
        gym.RewardWrapper.__init__(self, env) 
开发者ID:Stable-Baselines-Team,项目名称:stable-baselines,代码行数:9,代码来源:atari_wrappers.py

示例6: __init__

# 需要导入模块: import gym [as 别名]
# 或者: from gym import RewardWrapper [as 别名]
def __init__(self, env):
        """
        clips the reward to {+1, 0, -1} by its sign.
        :param env: (Gym Environment) the environment
        """
        gym.RewardWrapper.__init__(self, env) 
开发者ID:StepNeverStop,项目名称:RLs,代码行数:8,代码来源:wrappers.py


注:本文中的gym.RewardWrapper方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。