docstr: A reward network that predicts slate reward.
  
  It uses a transformer-based encoder to encode the items shown in the slate.
  The slate reward is predicted by attending all encoder steps' outputs.
code: def __init__(
      self,
      state_dim: int,
      candidate_dim: int,
      num_stacked_layers: int,
      num_heads: int,
      dim_model: int,
      dim_feedforward: int,
      max_src_seq_len: int,
      max_tgt_seq_len: int,
  ):
      """
      A reward network that predicts slate reward.
  
      It uses a transformer-based encoder to encode the items shown in the slate.
      The slate reward is predicted by attending all encoder steps' outputs.
      """
      super().__init__(
          state_dim,
          candidate_dim,
          dim_model,
          num_stacked_layers,
          max_src_seq_len,
          max_tgt_seq_len,
      )
      self.num_heads = num_heads
      self.dim_feedforward = dim_feedforward
  
      c = copy.deepcopy
      attn = MultiHeadedAttention(num_heads, dim_model)
      ff = PositionwiseFeedForward(dim_model, dim_feedforward)
      self.encoder = Encoder(
          EncoderLayer(dim_model, c(attn), c(ff)), num_stacked_layers
      )
      self.decoder = Decoder(
          DecoderLayer(dim_model, c(attn), c(attn), c(ff)),
          num_stacked_layers,
      )
      self.positional_encoding_encoder = PositionalEncoding(dim_model)
      self.positional_encoding_decoder = PositionalEncoding(dim_model)
      self.proj = nn.Linear(dim_model, 1)
      self.decoder_start_vec = nn.Parameter(
          torch.zeros(candidate_dim), requires_grad=True
      )
  
      self._init_params()
  
imports: import copy
  import logging
  from typing import List
  import torch
  import torch.nn
  import torch.nn.functional
  from reagent.core import types
  from reagent.core.torch_utils import gather
  from reagent.model_utils.seq2slate_utils import subsequent_mask
  from reagent.models.base import ModelBase
  from reagent.models.seq2slate import Decoder, DecoderLayer, Embedder, Encoder, EncoderLayer, MultiHeadedAttention, PositionalEncoding, PositionwiseFeedForward
label_desc: Use image node_id 1 to create a new Seq2SlateTransformerRewardNet object from inherited base classes: Seq2SlateRewardNetBase with example: obj = Seq2SlateTransformerRewardNet(state_dim, candidate_dim, num_stacked_layers, num_heads, dim_model, dim_feedforward, max_src_seq_len, max_tgt_seq_len)