code: def support_to_scalar(
      logits: torch.Tensor, support_range: Tuple[int, int]
  ) -> torch.Tensor:
      """Convert support vector to scalar by probability weighted interpolation.
  
      :param logits: Logits fed into a softmax to get probabilities in range [0, 1].
      :param support_range: Tuple holding the lower and upper bound of the supported value range.
      :return: Tensor of converted scalars.
      """
  
      # apply softmax
      probabilities = torch.softmax(logits, dim=-1)
  
      # compile support vector
      support = torch.from_numpy(
          np.arange(support_range[0], support_range[1] + 1).astype(
              np.float32
          )
      )
      support = support.to(device=probabilities.device)
  
      # compute probability weighted interpolation
      return torch.sum(support * probabilities, dim=-1)
  
file_path: maze/maze/train/trainers/common/value_transform.py
imports: from abc import ABC, abstractmethod
  from typing import Union, Tuple
  import numpy
  import torch
  from maze.core.annotations import override
  from maze.utils.bcolors import BColors
label_desc: Use image node_id 1 for calling a global function with example usage: support_to_scalar(logits, support_range) and returns: torch