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