def train(self, env_id, backend, train_params, env_params, means, stdevs):
    hid_size = train_params['hid_size']
    pol_init_std = train_params['pol_init_std']
    adam_epsilon = train_params['adam_epsilon']
    optim_stepsize = train_params['optim_stepsize']
    assert (len(means) == len(stdevs)), (len(means), len(stdevs))
    (mean_dict, stdev_dict) = PPO_Pytorch._vec_to_dict(env_id, means, stdevs)
    self.env_dist.default_parameters = mean_dict
    self.env_dist.stdev_dict = stdev_dict
    env = self.env_dist.root_env
    set_torch_num_threads()
    pol = Policy(env.observation_space, env.action_space, hid_size, pol_init_std)
    pol_optim = optim.Adam(pol.parameters(), lr=optim_stepsize, eps=adam_epsilon)
    val = ValueNet(env.observation_space, hid_size)
    val_optim = optim.Adam(val.parameters(), lr=optim_stepsize, eps=adam_epsilon)
    optims = {'pol_optim': pol_optim, 'val_optim': val_optim}
    num_train_iter = int((train_params['num_timesteps'] / train_params['ts_per_batch']))
    eps_rets_buff = deque(maxlen=100)
    eps_rets_mean_buff = []
    state_running_m_std = RunningMeanStd(shape=env.observation_space.shape)
    seg_gen = traj_seg_gen(self.env_dist, pol, val, state_running_m_std, env_params, train_params)
    eval_perfs = []
    for iter_i in range(num_train_iter):
        one_train_iter(pol, val, optims, iter_i, eps_rets_buff, eps_rets_mean_buff, seg_gen, state_running_m_std, train_params, self.eval_envs, eval_perfs)
    return eval_perfs
def train(self, env_id, backend, train_params, env_params, means, stdevs):
    hid_size = train_params['hid_size']
    pol_init_std = train_params['pol_init_std']
    adam_epsilon = train_params['adam_epsilon']
    optim_stepsize = train_params['optim_stepsize']
    assert (len(means) == len(stdevs)), (len(means), len(stdevs))
    (mean_dict, stdev_dict) = PPO_Pytorch._vec_to_dict(env_id, means, stdevs)
    self.env_dist.default_parameters = mean_dict
    self.env_dist.stdev_dict = stdev_dict
    env = self.env_dist.root_env
    set_torch_num_threads()
    pol = Policy(env.observation_space, env.action_space, hid_size, pol_init_std)
    pol_optim = optim.Adam(pol.parameters(), lr=optim_stepsize, eps=adam_epsilon)
    val = ValueNet(env.observation_space, hid_size)
    val_optim = optim.Adam(val.parameters(), lr=optim_stepsize, eps=adam_epsilon)
    optims = {'pol_optim': pol_optim, 'val_optim': val_optim}
    num_train_iter = int((train_params['num_timesteps'] / train_params['ts_per_batch']))
    eps_rets_buff = deque(maxlen=100)
    eps_rets_mean_buff = []
    state_running_m_std = RunningMeanStd(shape=env.observation_space.shape)
    seg_gen = traj_seg_gen(self.env_dist, pol, val, state_running_m_std, env_params, train_params)
    eval_perfs = []
    for iter_i in range(num_train_iter):
        one_train_iter(pol, val, optims, iter_i, eps_rets_buff, eps_rets_mean_buff, seg_gen, state_running_m_std, train_params, self.eval_envs, eval_perfs)
    return eval_perfs