(self)
Trains RL for one epoch.
Trains RL for one epoch.
Trains RL for one epoch .
def train_epoch(self):
    """Trains RL for one epoch."""
    # Update the target value network.
    self._value_eval_model.weights = self._value_trainer.model_weights
    self._value_eval_model.state = self._value_trainer.model_state

    # When restoring, calculate how many evals are remaining.
    n_evals = remaining_evals(
        self._value_trainer.step,
        self._epoch,
        self._value_train_steps_per_epoch,
        self._value_evals_per_epoch)
    for _ in range(n_evals):
      self._value_trainer.train_epoch(
          self._value_train_steps_per_epoch // self._value_evals_per_epoch,
          self._value_eval_steps)
      value_metrics = dict(
          {'exploration_rate': self._exploration_rate(self._epoch)})
      self._value_trainer.log_metrics(value_metrics,
                                      self._value_trainer._train_sw, 'dqn')  # pylint: disable=protected-access
    # Update the target value network.
    # TODO(henrykm) a bit tricky if sync_at does not coincide with epochs
    if self._sync_at(self._value_trainer.step):
      self._value_eval_model.weights = self._value_trainer.model_weights
      self._value_eval_model.state = self._value_trainer.model_state
def train_epoch ( self ) : # Update the target value network. self . _value_eval_model . weights = self . _value_trainer . model_weights self . _value_eval_model . state = self . _value_trainer . model_state # When restoring, calculate how many evals are remaining. n_evals = remaining_evals ( self . _value_trainer . step , self . _epoch , self . _value_train_steps_per_epoch , self . _value_evals_per_epoch ) for _ in range ( n_evals ) : self . _value_trainer . train_epoch ( self . _value_train_steps_per_epoch // self . _value_evals_per_epoch , self . _value_eval_steps ) value_metrics = dict ( { 'exploration_rate' : self . _exploration_rate ( self . _epoch ) } ) self . _value_trainer . log_metrics ( value_metrics , self . _value_trainer . _train_sw , 'dqn' ) # pylint: disable=protected-access # Update the target value network. # TODO(henrykm) a bit tricky if sync_at does not coincide with epochs if self . _sync_at ( self . _value_trainer . step ) : self . _value_eval_model . weights = self . _value_trainer . model_weights self . _value_eval_model . state = self . _value_trainer . model_state