code: def translate_x_to_alpha(x, x_input, x_baseline):
      """Translates a point on straight-line path to its corresponding alpha value.
  
      Args:
        x: the point on the straight-line path.
        x_input: the end point of the straight-line path.
        x_baseline: the start point of the straight-line path.
  
      Returns:
        The alpha value in range [0, 1] that shows the relative location of the
        point between x_baseline and x_input.
      """
      with np.errstate(divide="ignore", invalid="ignore"):
          return np.where(
              x_input - x_baseline != 0,
              (x - x_baseline) / (x_input - x_baseline),
              np.nan,
          )
  
file_path: saliency/saliency/core/guided_ig.py
imports: from .base import CoreSaliency
  from .base import INPUT_OUTPUT_GRADIENTS
  import math
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: translate_x_to_alpha(x, x_input, x_baseline) and returns: np