class_docstr: The user choice model for SlateQ.
  
  This class implements a multinomial logit model for predicting user clicks.
  
  Under this model, the click probability of a document is proportional to:
  
  .. math::
      \exp(   ext{beta} *     ext{doc_user_affinity} +        ext{score_no_click})
class_docstr_tok: ["The","user","choice","model","for","SlateQ",".","This","class","implements","a","multinomial","logit","model","for","predicting","user","clicks",".","Under","this","model",",","the","click","probability","of","a","document","is","proportional","to",":","..","math",":",":","\\exp","(","ext","{","beta","}","*","ext","{","doc_user_affinity","}","+","ext","{","score_no_click","}",")"]
docstr: Evaluate the user choice model.
  
  This function outputs user click scores for candidate documents. The
  exponentials of these scores are proportional user click probabilities.
  Here we return the scores unnormalized because only some of the
  documents will be selected and shown to the user.
  
  Args:
      user: User embeddings of shape (batch_size, user embedding size).
      doc: Doc embeddings of shape (batch_size, num_docs, doc embedding size).
  
  Returns:
      score: logits of shape (batch_size, num_docs + 1),
          where the last dimension represents no_click.
docstr_tok: ["Evaluate","the","user","choice","model",".","This","function","outputs","user","click","scores","for","candidate","documents",".","The","exponentials","of","these","scores","are","proportional","user","click","probabilities",".","Here","we","return","the","scores","unnormalized","because","only","some","of","the","documents","will","be","selected","and","shown","to","the","user",".","Args",":","user",":","User","embeddings","of","shape","(","batch_size",",","user","embedding","size",")",".","doc",":","Doc","embeddings","of","shape","(","batch_size",",","num_docs",",","doc","embedding","size",")",".","Returns",":","score",":","logits","of","shape","(","batch_size",",","num_docs","+","1",")",",","where","the","last","dimension","represents","no_click","."]
code: def forward(self, user: TensorType, doc: TensorType) -> TensorType:
      """Evaluate the user choice model.
  
      This function outputs user click scores for candidate documents. The
      exponentials of these scores are proportional user click probabilities.
      Here we return the scores unnormalized because only some of the
      documents will be selected and shown to the user.
  
      Args:
          user: User embeddings of shape (batch_size, user embedding size).
          doc: Doc embeddings of shape (batch_size, num_docs, doc embedding size).
  
      Returns:
          score: logits of shape (batch_size, num_docs + 1),
              where the last dimension represents no_click.
      """
      batch_size = user.shape[0]
      # Reduce across the embedding axis.
      s = torch.einsum("be,bde->bd", user, doc)
      # s=[batch, num-docs]
  
      # Multiply with learnable single "click" weight.
      s = s * self.beta
      # Add the learnable no-click score.
      s = torch.cat(
          [s, self.score_no_click.expand((batch_size, 1))], dim=1
      )
  
      return s
  
file_path: ray/rllib_contrib/slate_q/src/rllib_slate_q/slate_q/slateq_torch_model.py
imports: from typing import List, Sequence
  import gymnasium
  from ray.rllib.models.torch.misc import SlimFC
  from ray.rllib.models.torch.torch_modelv2 import TorchModelV2
  from ray.rllib.utils.framework import try_import_torch
  from ray.rllib.utils.typing import ModelConfigDict, TensorType
label_desc: Use image node_id 2 for calling the UserChoiceModel obj's underlying member method code with example usage: obj.forward(user, doc) and returns: s