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


Python seeding.hash_seed方法代码示例

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


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

示例1: seed

# 需要导入模块: from gym.utils import seeding [as 别名]
# 或者: from gym.utils.seeding import hash_seed [as 别名]
def seed(self, seed=None):
        self.np_random, seed1 = seeding.np_random(seed)
        # Derive a random seed. This gets passed as a uint, but gets
        # checked as an int elsewhere, so we need to keep it below
        # 2**31.
        seed2 = seeding.hash_seed(seed1 + 1) % 2**31
        # Empirically, we need to seed before loading the ROM.
        self.ale.setInt(b'random_seed', seed2)
        self.ale.loadROM(self.game_path)
        return [seed1, seed2] 
开发者ID:ArztSamuel,项目名称:DRL_DeliveryDuel,代码行数:12,代码来源:atari_env.py

示例2: _seed

# 需要导入模块: from gym.utils import seeding [as 别名]
# 或者: from gym.utils.seeding import hash_seed [as 别名]
def _seed(self, seed=None):
        self.np_random, seed1 = seeding.np_random(seed)
        # Derive a random seed.
        seed2 = seeding.hash_seed(seed1 + 1) % 2**32
        return [seed1, seed2] 
开发者ID:rockingdingo,项目名称:gym-gomoku,代码行数:7,代码来源:gomoku.py

示例3: seed

# 需要导入模块: from gym.utils import seeding [as 别名]
# 或者: from gym.utils.seeding import hash_seed [as 别名]
def seed(self, n):
        self.np_random, seed1 = seeding.np_random(n)
        seed2 = seeding.hash_seed(seed1 + 1) % 2 ** 31
        return [seed1, seed2] 
开发者ID:koulanurag,项目名称:ma-gym,代码行数:6,代码来源:combat.py

示例4: seed

# 需要导入模块: from gym.utils import seeding [as 别名]
# 或者: from gym.utils.seeding import hash_seed [as 别名]
def seed(self, seed=None):
        self.curr_seed = seeding.hash_seed(seed, max_bytes=4)
        self.rng, _ = seeding.np_random(seed=self.curr_seed)
        return [self.curr_seed, self.rng] 
开发者ID:alex-petrenko,项目名称:sample-factory,代码行数:6,代码来源:doom_gym.py

示例5: seed

# 需要导入模块: from gym.utils import seeding [as 别名]
# 或者: from gym.utils.seeding import hash_seed [as 别名]
def seed(self, seed=None):
        self.np_random, seed1 = seeding.np_random(seed)
        # Derive a random seed. This gets passed as a uint, but gets
        # checked as an int elsewhere, so we need to keep it below
        # 2**31.
        seed2 = seeding.hash_seed(seed1 + 1) % 2**31
        # Empirically, we need to seed before loading the ROM.
        self.ale.setInt(b'random_seed', seed2)
        self.ale.loadROM(self.game_path)

        if self.game_mode is not None:
            modes = self.ale.getAvailableModes()

            assert self.game_mode in modes, (
                "Invalid game mode \"{}\" for game {}.\nAvailable modes are: {}"
            ).format(self.game_mode, self.game, modes)
            self.ale.setMode(self.game_mode)

        if self.game_difficulty is not None:
            difficulties = self.ale.getAvailableDifficulties()

            assert self.game_difficulty in difficulties, (
                "Invalid game difficulty \"{}\" for game {}.\nAvailable difficulties are: {}"
            ).format(self.game_difficulty, self.game, difficulties)
            self.ale.setDifficulty(self.game_difficulty)

        return [seed1, seed2] 
开发者ID:hust512,项目名称:DQN-DDPG_Stock_Trading,代码行数:29,代码来源:atari_env.py

示例6: _seed

# 需要导入模块: from gym.utils import seeding [as 别名]
# 或者: from gym.utils.seeding import hash_seed [as 别名]
def _seed(self, seed=None):
        self.np_random, seed1 = seeding.np_random(seed=seed)
        # Derive a random seed. This gets passed as a uint, but gets
        # checked as an int elsewhere, so we need to keep it below
        # 2**31.
        seed2 = seeding.hash_seed(seed1 + 1) % 2**31
        seed3 = seeding.hash_seed(seed2 + 1) % 2**31
        return [seed1, seed2, seed3] 
开发者ID:jxx123,项目名称:simglucose,代码行数:10,代码来源:simglucose_gym_env.py

示例7: seed

# 需要导入模块: from gym.utils import seeding [as 别名]
# 或者: from gym.utils.seeding import hash_seed [as 别名]
def seed(self, seed=None):
        self.np_random, seed1 = seeding.np_random(seed)
        seed2 = seeding.hash_seed(seed1 + 1) % 2 ** 31
        return [seed1, seed2] 
开发者ID:PacktPublishing,项目名称:Deep-Reinforcement-Learning-Hands-On,代码行数:6,代码来源:environ.py


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