def __init__(self, logdir, env_fn, model_fn, nenv, rollout_length, batch_size, callback=None, runner_flags=[], **kwargs):
    self.exp = RLExperiment(logdir)
    self.exp.save_model_fn(model_fn)
    self.exp.save_env_fn(env_fn)
    logger.configure(os.path.join(logdir, 'logs'), ['stdout', 'log', 'json'])
    self.logdir = logdir
    self.batch_size = batch_size
    self.rollout_length = rollout_length
    self.args = namedtuple('Args', kwargs.keys())(**kwargs)
    self.nenv = nenv
    self.timesteps_per_step = (self.nenv * self.rollout_length)
    self.env = self._make_env(env_fn, nenv)
    self.actor = model_fn(self.env)
    self.actor.build('model', self.nenv, 1)
    self.loss = self._def_loss(model_fn, self.env)
    self.opt = self._def_opt(self.loss)
    self.opt.build('model', self.nenv, batch_size, reuse=tf.AUTO_REUSE)
    self.runner = Runner(self.env, self.actor, rollout_length, *runner_flags)
    self.callback = callback
    if (callback is not None):
        assert callable(callback)
    self.init_session()
    self.load()
def __init__(self, logdir, env_fn, model_fn, nenv, rollout_length, batch_size, callback=None, runner_flags=[], **kwargs):
    self.exp = RLExperiment(logdir)
    self.exp.save_model_fn(model_fn)
    self.exp.save_env_fn(env_fn)
    logger.configure(os.path.join(logdir, 'logs'), ['stdout', 'log', 'json'])
    self.logdir = logdir
    self.batch_size = batch_size
    self.rollout_length = rollout_length
    self.args = namedtuple('Args', kwargs.keys())(**kwargs)
    self.nenv = nenv
    self.timesteps_per_step = (self.nenv * self.rollout_length)
    self.env = self._make_env(env_fn, nenv)
    self.actor = model_fn(self.env)
    self.actor.build('model', self.nenv, 1)
    self.loss = self._def_loss(model_fn, self.env)
    self.opt = self._def_opt(self.loss)
    self.opt.build('model', self.nenv, batch_size, reuse=tf.AUTO_REUSE)
    self.runner = Runner(self.env, self.actor, rollout_length, *runner_flags)
    self.callback = callback
    if (callback is not None):
        assert callable(callback)
    self.init_session()
    self.load()