class_docstr: Seq2Slate without a decoder learned in a supervised learning fashion (
  https://arxiv.org/pdf/1904.06813.pdf )
class_docstr_tok: ["Seq2Slate","without","a","decoder","learned","in","a","supervised","learning","fashion","(","https",":","\/\/arxiv.org\/pdf\/1904.06813.pdf",")"]
code: def train_step_gen(
      self, training_batch: rlt.PreprocessedRankingInput, batch_idx: int
  ):
      assert type(training_batch) is rlt.PreprocessedRankingInput
  
      # shape: batch_size, tgt_seq_len
      encoder_scores = self.seq2slate_net(
          training_batch, mode=Seq2SlateMode.ENCODER_SCORE_MODE
      ).encoder_scores
      assert encoder_scores.requires_grad
  
      loss = self.kl_loss(
          self.log_softmax(encoder_scores),
          training_batch.position_reward,
      )
  
      detached_loss = loss.detach().cpu()
      self.reporter.log(train_cross_entropy_loss=detached_loss)
  
      yield loss
  
file_path: ReAgent/reagent/training/ranking/seq2slate_attn_trainer.py
imports: import logging
  import numpy
  import reagent.core.types
  import torch
  import torch.nn
  from reagent.core.dataclasses import field
  from reagent.model_utils.seq2slate_utils import Seq2SlateMode
  from reagent.models.seq2slate import Seq2SlateTransformerNet
  from reagent.optimizer.union import Optimizer__Union
  from reagent.training.reagent_lightning_module import ReAgentLightningModule
  from sklearn.metrics import average_precision_score, dcg_score, ndcg_score, roc_auc_score
label_desc: Use image node_id 3 for calling the Seq2SlatePairwiseAttnTrainer obj's underlying member method code with example usage: obj.train_step_gen(training_batch, batch_idx) without return types