class_docstr: Simple Cross Entropy Method.
  
  Args:
      env_spec (EnvSpec): Environment specification.
      policy (Policy): Action policy.
      sampler (garage.sampler.Sampler): Sampler.
docstr: Perform one step of policy optimization given one batch of samples.
  
  Args:
      epoch (int): Iteration number.
      paths (list[dict]): A list of collected paths.
  
  Returns:
      float: The average return of epoch cycle.
docstr_tok: ["Perform","one","step","of","policy","optimization","given","one","batch","of","samples",".","Args",":","epoch","(","int",")",":","Iteration","number",".","paths","(","list","[","dict","]",")",":","A","list","of","collected","paths",".","Returns",":","float",":","The","average","return","of","epoch","cycle","."]
code: def _train_once(self, epoch, paths):
      """Perform one step of policy optimization given one batch of samples.
  
      Args:
          epoch (int): Iteration number.
          paths (list[dict]): A list of collected paths.
  
      Returns:
          float: The average return of epoch cycle.
  
      """
      returns = []
      for path in paths:
          returns.append(
              discount_cumsum(path["rewards"], self._discount)
          )
      avg_return = np.mean(np.concatenate(returns))
      self._all_avg_returns.append(avg_return)
  
      if (epoch + 1) % self._n_samples == 0:
          avg_rtns = np.array(self._all_avg_returns)
          best_inds = np.argsort(-avg_rtns)[: self._n_best]
          best_params = np.array(self._all_params)[best_inds]
          self._cur_mean = best_params.mean(axis=0)
          self._cur_std = best_params.std(axis=0)
          self.policy.set_param_values(self._cur_mean)
          avg_return = max(self._all_avg_returns)
          self._all_avg_returns.clear()
          self._all_params.clear()
  
      self._cur_params = self._sample_params(epoch)
      self._all_params.append(self._cur_params.copy())
      self.policy.set_param_values(self._cur_params)
  
      return avg_return
  
file_path: garage/src/garage/examples/np/tutorial_cem.py
imports: import numpy
  from garage import EpisodeBatch, log_performance, wrap_experiment
  from garage.envs import GymEnv
  from garage.experiment.deterministic import set_seed
  from garage.np import discount_cumsum
  from garage.sampler import LocalSampler
  from garage.tf.policies import CategoricalMLPPolicy
  from garage.trainer import TFTrainer
label_desc: Use image node_id 3 for calling the SimpleCEM obj's underlying member method code with example usage: obj._train_once(epoch, paths) and returns: avg_return