code: def score_documents(
      user_obs,
      doc_obs,
      no_click_score=1.0,
      multinomial_logits=False,
      min_normalizer=-1.0,
  ):
      """Computes dot-product scores for user vs doc (plus no-click) feature vectors."""
  
      # Dot product between used and each document feature vector.
      scores_per_candidate = torch.sum(
          torch.multiply(
              user_obs.unsqueeze(1), torch.stack(doc_obs, dim=1)
          ),
          dim=2,
      )
      # Compile a constant no-click score tensor.
      score_no_click = torch.full(
          size=[user_obs.shape[0], 1], fill_value=no_click_score
      ).to(scores_per_candidate.device)
      # Concatenate click and no-click scores.
      all_scores = torch.cat(
          [scores_per_candidate, score_no_click], dim=1
      )
  
      # Logits: Softmax to yield probabilities.
      if multinomial_logits:
          all_scores = nn.functional.softmax(all_scores)
      # Multinomial proportional model: Shift to `[0.0,..[`.
      else:
          all_scores = all_scores - min_normalizer
  
      # Return click (per candidate document) and no-click scores.
      return all_scores[:, :-1], all_scores[:, -1]
  
imports: import logging
  from typing import Dict, Tuple, Type
  import gymnasium
  import numpy
  from rllib_slate_q.slate_q.slateq_torch_model import SlateQTorchModel
  from ray.rllib.models.modelv2 import ModelV2
  from ray.rllib.models.torch.torch_action_dist import TorchCategorical, TorchDistributionWrapper
  from ray.rllib.policy.policy import Policy
  from ray.rllib.policy.policy_template import build_policy_class
  from ray.rllib.policy.sample_batch import SampleBatch
  from ray.rllib.policy.torch_mixins import TargetNetworkMixin
  from ray.rllib.utils.framework import try_import_torch
  from ray.rllib.utils.torch_utils import apply_grad_clipping, concat_multi_gpu_td_errors, convert_to_torch_tensor, huber_loss
  from ray.rllib.utils.typing import AlgorithmConfigDict, TensorType
label_desc: Use image node_id 6 for calling a global function with example usage: score_documents(user_obs, doc_obs, no_click_score, multinomial_logits, min_normalizer) and returns: all_scores,  all_scores