code: def interpolate(
      interpolation_times,
      reference_times,
      reference_yields,
      dtype=None,
      name=None,
  ):
      """Performs the constant forward interpolation for supplied points.
  
      Given an interest rate yield curve whose maturities and the corresponding
      (continuously compounded) yields are in `reference_times` and
      `reference_yields`, this function returns interpolated yields at
      `interpolation_times` using the constant forward interpolation.
  
      Let `t_i, i=1,...,n` and `y_i, i=1,...,n` denote the reference_times and
      reference_yields respectively. If `t` is a maturity for which the
      interpolation is desired such that t_{i-1} <= t <= t_i, then constant forward
      interpolation produces the corresponding yield, `y_t`, such that the forward
      rate in the interval `[t_{i-1},t]` is the same as the forward rate in the
      interval `[t_{i-1},t_i]`. Mathematically, this is the same as linearly
      interpolating `t*y_t` using the curve `t_i, t_i*y_i`.
  
      `reference_times` must be strictly increasing but `reference_yields` don't
      need to be because we don't require the rate curve to be monotonic.
  
      #### Examples
  
      ```python
      interpolation_times = [1, 3, 6, 7, 8, 15, 18, 25, 30]
      # `reference_times` must be increasing, but `reference_yields` don't need to
      # be.
      reference_times = [0.0, 2.0, 6.0, 8.0, 18.0, 30.0]
      reference_yields = [0.01, 0.02, 0.015, 0.014, 0.02, 0.025]
      result = interpolate(interpolation_times, reference_times, reference_yields)
      ```
  
      Args:
        interpolation_times: The times at which interpolation is desired. A N-D
          `Tensor` of real dtype where the first N-1 dimensions represent the
          batching dimensions.
        reference_times: Maturities in the input yield curve. A N-D `Tensor` of
          real dtype where the first N-1 dimensions represent the batching
          dimensions. Should be sorted in increasing order.
        reference_yields: Continuously compounded yields corresponding to
          `reference_times`. A N-D `Tensor` of real dtype. Should have the
          compatible shape as `x_data`.
        dtype: Optional tf.dtype for `interpolation_times`, reference_times`,
          and `reference_yields`. If not specified, the dtype of the inputs will be
          used.
        name: Python str. The name prefixed to the ops created by this function. If
          not supplied, the default name 'constant_fwd_interpolation' is used.
  
      Returns:
        A N-D `Tensor` of real dtype with the same shape as `interpolations_times`
          containing the interpolated yields.
      """
      with tf.compat.v1.name_scope(
          name,
          default_name="constant_fwd_interpolation",
          values=[
              interpolation_times,
              reference_times,
              reference_yields,
          ],
      ):
          interpolation_times = tf.convert_to_tensor(
              interpolation_times, dtype=dtype
          )
          dtype = dtype or interpolation_times.dtype
          reference_times = tf.convert_to_tensor(
              reference_times, dtype=dtype
          )
          reference_yields = tf.convert_to_tensor(
              reference_yields, dtype=dtype
          )
  
          # Currently only flat extrapolation is being supported. We achieve this by
          # clipping the interpolation times between minimum and maximum times of the
          # input curve.
          reference_times_min = tf.reduce_min(
              reference_times, axis=-1, keepdims=True
          )
          reference_times_max = tf.reduce_max(
              reference_times, axis=-1, keepdims=True
          )
          interpolation_times = tf.minimum(
              reference_times_max,
              tf.maximum(reference_times_min, interpolation_times),
          )
  
          interpolated_prod = linear_interpolation.interpolate(
              interpolation_times,
              reference_times,
              reference_times * reference_yields,
              dtype=dtype,
          )
          interpolated = interpolated_prod / interpolation_times
          return interpolated
  
label_desc: Use image node_id 1 for calling a global function with example usage: interpolate(interpolation_times, reference_times, reference_yields, dtype, name) and returns: interpolated