class_docstr: A trainer for the DQN algorithm and its variants.
  
  Configures optimizers, builds the losses and train functions for the
  Q-learning based algorithm variants. Supports MaxQ and SARSA style
  TD-learning under both, standard and batch-constrained q-learning.
  During training, updates CPE metrics estimators.
  
  Attributes:
      double_q_learning: a boolean flag whether to use double-q learning.
      minibatch_size: an int number of samples per minibatch.
      minibatches_per_step: an int number of minibatch updates per step.
      q_network: a network object mapping states to q-values of all actions.
      q_network_target: a copy of q-network for training stability used in
          estimating q-values targets.
      q_network_optimizer: an optimizer object for training q-network.
      bcq: a config file for batch-constrained q-learning (BCQ).
      bcq_imitator: if using batch-constrained q-learning, the behavior
          policy used for BCQ training.
      all_action_scores: a torch tensor containing q-network
              predictions from the current states.
docstr: Converts values tensor to a dict mapping action names to values.
  
  Example: tensor([1.0, 0.0, 1.0]) -> {"1": 1.0, "2": 0.0, "3": 1.0}.
docstr_tok: ["Converts","values","tensor","to","a","dict","mapping","action","names","to","values",".","Example",":","tensor","(","[","1.0",",","0.0",",","1.0","]",")","-",">","{","``","1","''",":","1.0",",","``","2","''",":","0.0",",","``","3","''",":","1.0","}","."]
code: def _dense_to_action_dict(self, dense: torch.Tensor):
      """Converts values tensor to a dict mapping action names to values.
  
      Example: tensor([1.0, 0.0, 1.0]) -> {"1": 1.0, "2": 0.0, "3": 1.0}.
      """
      assert dense.size() == (
          self.num_actions,
      ), f"Invalid dense size {dense.size()} != {(self.num_actions,)}"
      retval = {}
      for i, a in enumerate(self._actions):
          retval[a] = dense[i]
      return retval
  
imports: import logging
  from typing import List, Optional, Tuple
  import reagent.core.types
  import torch
  from reagent.core.configuration import resolve_defaults
  from reagent.core.dataclasses import dataclass, field
  from reagent.core.parameters import EvaluationParameters, RLParameters
  from reagent.optimizer import Optimizer__Union, SoftUpdate
  from reagent.training.dqn_trainer_base import DQNTrainerBaseLightning
  from reagent.training.imitator_training import get_valid_actions_from_imitator
label_desc: Use image node_id 8 for calling the DQNTrainer obj's underlying member method code with example usage: obj._dense_to_action_dict(dense) and returns: retval