當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。