docstr: Initializes a QValueModel instance.
  
  Each document candidate receives one full Q-value stack, defined by
  `fcnet_hiddens_per_candidate`. The input to each of these Q-value stacks
  is always {[user] concat [document[i]] for i in document_candidates}.
  
  Extra model kwargs:
      fcnet_hiddens_per_candidate: List of layer-sizes for each(!) of the
          candidate documents.
docstr_tok: ["Initializes","a","QValueModel","instance",".","Each","document","candidate","receives","one","full","Q-value","stack",",","defined","by","`","fcnet_hiddens_per_candidate","`",".","The","input","to","each","of","these","Q-value","stacks","is","always","{","[","user","]","concat","[","document","[","i","]","]","for","i","in","document_candidates","}",".","Extra","model","kwargs",":","fcnet_hiddens_per_candidate",":","List","of","layer-sizes","for","each","(","!",")","of","the","candidate","documents","."]
code: def __init__(
      self,
      obs_space: gym.spaces.Space,
      fcnet_hiddens_per_candidate=(256, 32),
  ):
      """Initializes a QValueModel instance.
  
      Each document candidate receives one full Q-value stack, defined by
      `fcnet_hiddens_per_candidate`. The input to each of these Q-value stacks
      is always {[user] concat [document[i]] for i in document_candidates}.
  
      Extra model kwargs:
          fcnet_hiddens_per_candidate: List of layer-sizes for each(!) of the
              candidate documents.
      """
      super().__init__()
  
      self.orig_obs_space = obs_space
      self.embedding_size = self.orig_obs_space["doc"]["0"].shape[0]
      self.num_candidates = len(self.orig_obs_space["doc"])
      assert self.orig_obs_space["user"].shape[0] == self.embedding_size
  
      self.q_nets = nn.ModuleList()
      for i in range(self.num_candidates):
          layers = nn.Sequential()
          ins = 2 * self.embedding_size
          for j, h in enumerate(fcnet_hiddens_per_candidate):
              layers.add_module(
                  f"q_layer_{i}_{j}",
                  SlimFC(in_size=ins, out_size=h, activation_fn="relu"),
              )
              ins = h
          layers.add_module(
              f"q_out_{i}", SlimFC(ins, 1, activation_fn=None)
          )
  
          self.q_nets.append(layers)
  
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 1 to create a new QValueModel object from inherited base classes: nn with example: obj = QValueModel(obs_space, fcnet_hiddens_per_candidate)