Skip to content

StandardLoss ​

python
StandardLoss(config: DQNExperimentConfiguration, learner_model_container: ThreadSafeModel, target_model: DQNModel, apply_action_mask: Callable[[torch.Tensor], torch.Tensor]) -> None

Loss strategy for standard (non-categorical) DQN, selected once per Learner.

Initialize the standard-loss strategy.

Parameters:

  • config (DQNExperimentConfiguration) – The DQN experiment configuration.
  • learner_model_container (ThreadSafeModel) – The learner model container (with lock).
  • target_model (DQNModel) – The target DQN model.
  • apply_action_mask (Callable[[Tensor], Tensor]) – Callable that masks excluded actions in Q-values.

Source

Methods ​

compute ​

python
compute(batch: LearnerBatch) -> LossResult

Compute the standard DQN loss for a sampled batch.

Parameters:

  • batch (LearnerBatch) – The sampled learner batch.

Returns:

  • LossResult – The computed loss and diagnostics.

Source