CategoricalLoss
python
CategoricalLoss(config: DQNExperimentConfiguration, learner_model_container: ThreadSafeModel, target_model: DQNModel, categorical_projection: CategoricalProjection, apply_action_mask: Callable[[torch.Tensor], torch.Tensor]) -> NoneLoss strategy for categorical (C51) DQN, selected once per Learner.
Initialize the categorical-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.categorical_projection(CategoricalProjection) – The categorical (C51) target-distribution projection.apply_action_mask(Callable[[Tensor], Tensor]) – Callable that masks excluded actions in Q-values.
Methods
compute
python
compute(batch: LearnerBatch) -> LossResultCompute the categorical DQN loss for a sampled batch.
Parameters:
batch(LearnerBatch) – The sampled learner batch.
Returns:
LossResult– The computed loss and diagnostics.