rllib/agents/dqn/apex.py
def update_replay_sample_priority(self) -> int:
        """Update the priorities of the sample batches with new priorities that are
        computed by the learner thread.

        Returns:
            The number of samples trained by the learner thread since the last
            training iteration.
        """
        num_samples_trained_this_itr = 0
        for _ in range(self.learner_thread.outqueue.qsize()):
            if self.learner_thread.is_alive():
                (
                    replay_actor,
                    priority_dict,
                    env_steps,
                    agent_steps,
                ) = self.learner_thread.outqueue.get(timeout=0.001)
                if self.config["prioritized_replay"]:
                    replay_actor.update_priorities.remote(priority_dict)
                num_samples_trained_this_itr += env_steps
                self.update_target_networks(env_steps)
                self._counters[NUM_ENV_STEPS_TRAINED] += env_steps
                self._counters[NUM_AGENT_STEPS_TRAINED] += agent_steps
                self.workers.local_worker().set_global_vars(
                    {"timestep": self._counters[NUM_ENV_STEPS_TRAINED]}
                )
            else:
                raise RuntimeError("The learner thread died in while training")

        self._counters[STEPS_TRAINED_THIS_ITER_COUNTER] = num_samples_trained_this_itr
        self._timers["learner_dequeue"] = self.learner_thread.queue_timer
        self._timers["learner_grad"] = self.learner_thread.grad_timer
        self._timers["learner_overall"] = self.learner_thread.overall_timer
Update the priorities of the sample batches with new priorities that are
        computed by the learner thread.

        Returns:
            The number of samples trained by the learner thread since the last
            training iteration.
        
Update the priorities of the sample batches with new priorities that are
computed by the learner thread.
Update the priorities of the sample batches with new priorities that are computed by the learner thread .
def update_replay_sample_priority(self) -> int:
        num_samples_trained_this_itr = 0
        for _ in range(self.learner_thread.outqueue.qsize()):
            if self.learner_thread.is_alive():
                (
                    replay_actor,
                    priority_dict,
                    env_steps,
                    agent_steps,
                ) = self.learner_thread.outqueue.get(timeout=0.001)
                if self.config["prioritized_replay"]:
                    replay_actor.update_priorities.remote(priority_dict)
                num_samples_trained_this_itr += env_steps
                self.update_target_networks(env_steps)
                self._counters[NUM_ENV_STEPS_TRAINED] += env_steps
                self._counters[NUM_AGENT_STEPS_TRAINED] += agent_steps
                self.workers.local_worker().set_global_vars(
                    {"timestep": self._counters[NUM_ENV_STEPS_TRAINED]}
                )
            else:
                raise RuntimeError("The learner thread died in while training")
        self._counters[STEPS_TRAINED_THIS_ITER_COUNTER] = num_samples_trained_this_itr
        self._timers["learner_dequeue"] = self.learner_thread.queue_timer
        self._timers["learner_grad"] = self.learner_thread.grad_timer
        self._timers["learner_overall"] = self.learner_thread.overall_timer
def update_replay_sample_priority ( self ) -> int : num_samples_trained_this_itr = 0 for _ in range ( self . learner_thread . outqueue . qsize ( ) ) : if self . learner_thread . is_alive ( ) : ( replay_actor , priority_dict , env_steps , agent_steps , ) = self . learner_thread . outqueue . get ( timeout = 0.001 ) if self . config [ "prioritized_replay" ] : replay_actor . update_priorities . remote ( priority_dict ) num_samples_trained_this_itr += env_steps self . update_target_networks ( env_steps ) self . _counters [ NUM_ENV_STEPS_TRAINED ] += env_steps self . _counters [ NUM_AGENT_STEPS_TRAINED ] += agent_steps self . workers . local_worker ( ) . set_global_vars ( { "timestep" : self . _counters [ NUM_ENV_STEPS_TRAINED ] } ) else : raise RuntimeError ( "The learner thread died in while training" ) self . _counters [ STEPS_TRAINED_THIS_ITER_COUNTER ] = num_samples_trained_this_itr self . _timers [ "learner_dequeue" ] = self . learner_thread . queue_timer self . _timers [ "learner_grad" ] = self . learner_thread . grad_timer self . _timers [ "learner_overall" ] = self . learner_thread . overall_timer
Update the priorities of the sample batches with new priorities that are
computed by the learner thread.
Update the priorities of the sample batches with new priorities that are computed by the learner thread .
"""Update the priorities of the sample batches with new priorities that are
        computed by the learner thread.

        Returns:
            The number of samples trained by the learner thread since the last
            training iteration.
        """
The number of samples trained by the learner thread since the last
training iteration.
The number of samples trained by the learner thread since the last training iteration .
self