code: def test_support_to_scalar():
      """unit test"""
  
      # single vector
      logits = np.full(11, fill_value=0, dtype=np.float32)
      logits[3] = 0.3
      logits[4] = 0.7
      logits = torch.from_numpy(logits)
      scalar = support_to_scalar(logits, support_range=(0, 10))
      assert scalar.shape == ()
      assert np.allclose(scalar, 4.861410140991211)
  
      # batch of vectors
      logits = np.full((10, 11), fill_value=0, dtype=np.float32)
      logits[:, 3] = 0.3
      logits[:, 4] = 0.7
      logits = torch.from_numpy(logits)
      scalar = (
          support_to_scalar(logits, support_range=(0, 10)).cpu().numpy()
      )
      assert scalar.shape == (10,)
      assert np.allclose(scalar, 4.861410140991211)
  
file_path: maze/maze/test/train/common/test_value_transform.py
imports: import io
  from contextlib import redirect_stdout
  import numpy
  import torch
  from maze.train.trainers.common.value_transform import support_to_scalar, scalar_to_support, ReduceScaleValueTransform
label_desc: Use image node_id 2 for calling a global function with example usage: test_support_to_scalar() without return types