subproc_vec_env.py 文件源码

python
阅读 33 收藏 0 点赞 0 评论 0

项目:pysc2-examples 作者: chris-chris 项目源码 文件源码
def __init__(self, nenvs, map_name):
    """
envs: list of gym environments to run in subprocesses
"""

    self.remotes, self.work_remotes = zip(*[Pipe() for _ in range(nenvs)])

    self.ps = []
    i = 0
    for (work_remote, ) in zip(self.work_remotes, ):
      self.ps.append(
        Process(target=worker, args=(work_remote, map_name, i)))
      i += 1

    #
    # self.ps = [Process(target=worker, args=(work_remote, (map_name)))
    #            for (work_remote,) in zip(self.work_remotes,)]
    for p in self.ps:
      p.start()

    self.remotes[0].send(('get_spaces', 1))
    self.action_space, self.observation_space = self.remotes[0].recv()
    #print("action_space: ", self.action_space, " observation_space: ", self.observation_space)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号