class_docstr: Critic Regularized Regression (CRR) algorithm trainer
  as described in https://arxiv.org/abs/2006.15134
code: def validation_step(self, batch, batch_idx):
      # As explained in the comments to the validation_step function in
      # pytorch_lightning/core/lightning.py, this function operates on a
      # single batch of data from the validation set. For example:
      # val_outs = []
      # for val_batch in val_data:
      #     out = validation_step(val_batch)
      #     val_outs.append(out)
      # validation_epoch_end(val_outs)
      # Note: the relevant validation_epoch_end() function is defined in dqn_trainer_base.py
  
      # RETURN ARGS:
      # The super() call at the end of this function calls the function with the same name
      # in dqn_trainer_base.py, which returns a EvaluationDataPage for data in that batch.
      # In other words, the validation_epoch_end() function will take a list of validation
      # EvaluationDataPages.
  
      if isinstance(batch, dict):
          batch = rlt.DiscreteDqnInput.from_dict(batch)
  
      # validation data
      state = batch.state
      action = batch.action
      next_state = batch.next_state
      not_terminal = batch.not_terminal
      rewards = self.boost_rewards(batch.reward, action)
  
      # intermediate values
      next_q_values = self.q1_network_target(next_state)
      target_q_values = self.compute_target_q_values(
          next_state, rewards, not_terminal, next_q_values
      )
      all_q_values = self.q1_network(state)
      all_action_scores = self.actor_network(state).action
      logged_action_probs = batch.extras.action_probability
  
      # loss to log
      actor_loss_without_reg, actor_loss = self.compute_actor_loss(
          batch_idx,
          action,
          logged_action_probs,
          all_q_values,
          all_action_scores,
      )
      td_loss = self.compute_td_loss(
          self.q1_network, state, action, target_q_values
      )
  
      self.log(
          "eval_actor_loss_without_reg",
          actor_loss_without_reg,
          batch_size=batch.batch_size(),
      )
      self.log(
          "eval_actor_loss", actor_loss, batch_size=batch.batch_size()
      )
      self.log("eval_td_loss", td_loss, batch_size=batch.batch_size())
  
      return super().validation_step(batch, batch_idx)
  
imports: import logging
  from typing import List, Tuple
  import reagent.core.types
  import torch
  import torch.nn.functional
  from reagent.core.configuration import resolve_defaults
  from reagent.core.dataclasses import field
  from reagent.core.parameters import EvaluationParameters, RLParameters
  from reagent.optimizer import Optimizer__Union, SoftUpdate
  from reagent.training.dqn_trainer_base import DQNTrainerBaseLightning
  from torch import distributions
label_desc: Use image node_id 9 for calling the DiscreteCRRTrainer obj's underlying member method code with example usage: obj.validation_step(batch, batch_idx) and returns: super