@override(Agent)
def _train(self):
    if ('observation_filter' not in self.raw_user_config):
        logger.info("Important! Since 0.7.0, observation normalization is no longer enabled by default. To enable running-mean normalization, set 'observation_filter': 'MeanStdFilter'. You can ignore this message if your environment doesn't require observation normalization.")
    prev_steps = self.optimizer.num_steps_sampled
    fetches = self.optimizer.step()
    if ('kl' in fetches):
        self.local_evaluator.for_policy((lambda pi: pi.update_kl(fetches['kl'])))
    else:

        def update(pi, pi_id):
            if (pi_id in fetches):
                pi.update_kl(fetches[pi_id]['kl'])
            else:
                logger.debug('No data for {}, not updating kl'.format(pi_id))
        self.local_evaluator.foreach_trainable_policy(update)
    res = self.optimizer.collect_metrics(self.config['collect_metrics_timeout'])
    res.update(timesteps_this_iter=(self.optimizer.num_steps_sampled - prev_steps), info=dict(fetches, **res.get('info', {})))
    if (self.config['vf_clip_param'] <= 0):
        rew_scale = float('inf')
    elif res['policy_reward_mean']:
        rew_scale = 0
    else:
        rew_scale = round((abs(res['episode_reward_mean']) / self.config['vf_clip_param']), 0)
    if (rew_scale > 100):
        logger.warning((('The magnitude of your environment rewards are more than {}x the scale of `vf_clip_param`. '.format(rew_scale) + 'This means that it will take more than {} iterations for your value '.format(rew_scale)) + 'function to converge. If this is not intended, consider increasing `vf_clip_param`.'))
    return res
@override(Agent)
def _train(self):
    if ('observation_filter' not in self.raw_user_config):
        logger.info("Important! Since 0.7.0, observation normalization is no longer enabled by default. To enable running-mean normalization, set 'observation_filter': 'MeanStdFilter'. You can ignore this message if your environment doesn't require observation normalization.")
    prev_steps = self.optimizer.num_steps_sampled
    fetches = self.optimizer.step()
    if ('kl' in fetches):
        self.local_evaluator.for_policy((lambda pi: pi.update_kl(fetches['kl'])))
    else:

        def update(pi, pi_id):
            if (pi_id in fetches):
                pi.update_kl(fetches[pi_id]['kl'])
            else:
                logger.debug('No data for {}, not updating kl'.format(pi_id))
        self.local_evaluator.foreach_trainable_policy(update)
    res = self.optimizer.collect_metrics(self.config['collect_metrics_timeout'])
    res.update(timesteps_this_iter=(self.optimizer.num_steps_sampled - prev_steps), info=dict(fetches, **res.get('info', {})))
    if (self.config['vf_clip_param'] <= 0):
        rew_scale = float('inf')
    elif res['policy_reward_mean']:
        rew_scale = 0
    else:
        rew_scale = round((abs(res['episode_reward_mean']) / self.config['vf_clip_param']), 0)
    if (rew_scale > 100):
        logger.warning((('The magnitude of your environment rewards are more than {}x the scale of `vf_clip_param`. '.format(rew_scale) + 'This means that it will take more than {} iterations for your value '.format(rew_scale)) + 'function to converge. If this is not intended, consider increasing `vf_clip_param`.'))
    return res