def METHOD_NAME(learner: Learner, dataset: AttrDict, num_invalids: int) -> AttrDict:
    # noinspection PyProtectedMember
    (
        action_distribution,
        policy_loss,
        exploration_loss,
        kl_old,
        kl_loss,
        value_loss,
        loss_locals,
    ) = learner._calculate_losses(dataset, num_invalids)
    return AttrDict(
        policy_loss=policy_loss,
        exploration_loss=exploration_loss,
        kl_old=kl_old,
        kl_loss=kl_loss,
        value_loss=value_loss,
    )