本文整理汇总了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]
示例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]
示例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]
示例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]
示例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]
示例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]
示例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]