code: def normalize_signed_saliency(saliency: np.ndarray) -> np.ndarray:
      """Normalizes saliency map while preserving the sign and relative ratios.
  
      All result values are in interval [0, 1] but may assume a narrower interval.
      Value 0 in the original saliency array is mapped to 0.5 in the result
      saliency. E.g. the normalization of values in range [-10, 100] results in the
      output, which values belong to interval [0,45, 1.0].
  
      Args:
        saliency: a saliency map that should be normalized.
  
      Returns:
        The normalized saliency map.
      """
      saliency = saliency.astype(np.float32)
      max_abs_val = np.abs(saliency).max()
      if max_abs_val > 0:
          return (saliency / max_abs_val) / 2 + 0.5
      else:
          return saliency
  
file_path: lit/lit_nlp/lib/image_utils.py
imports: import base64
  import io
  from typing import Optional
  import matplotlib.cm
  import numpy
  from PIL import Image
  from PIL import ImageEnhance
label_desc: Use image node_id 4 for calling a global function with example usage: normalize_signed_saliency(saliency) and returns: unknown, saliency