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: Computes a discount tensor to be used in td-error estimation.
docstr_tok: ["Computes","a","discount","tensor","to","be","used","in","td-error","estimation","."]
code: def compute_discount_tensor(
      self, batch: rlt.DiscreteDqnInput, boosted_rewards: torch.Tensor
  ):
      """Computes a discount tensor to be used in td-error estimation."""
      discount_tensor = torch.full_like(boosted_rewards, self.gamma)
      if self.use_seq_num_diff_as_time_diff:
          assert self.multi_steps is None
          discount_tensor = torch.pow(
              self.gamma, batch.time_diff.float()
          )
      if self.multi_steps is not None:
          assert batch.step is not None
          discount_tensor = torch.pow(self.gamma, batch.step.float())
      return discount_tensor
  
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 4 for calling the DQNTrainer obj's underlying member method code with example usage: obj.compute_discount_tensor(batch, boosted_rewards) and returns: discount_tensor