code: def _compute_pv(
      cashflows, cashflow_times, reference_rates, reference_times
  ):
      times = tf.concat(cashflow_times, axis=0)
      groups = tf.concat(
          [
              tf.zeros_like(cashflow, dtype=tf.int32) + i
              for i, cashflow in enumerate(cashflows)
          ],
          axis=0,
      )
      rates = monotone_convex.interpolate_yields(
          times, reference_times, yields=reference_rates
      )
      discounts = tf.math.exp(-times * rates)
      cashflows = tf.concat(cashflows, axis=0)
      return tf.math.segment_sum(discounts * cashflows, groups)
  
imports: import math
  from absl.testing import parameterized
  import numpy
  import tensorflow.compat.v2
  from tensorflow.python.framework import test_util
  from tf_quant_finance.rates.hagan_west import bond_curve
  from tf_quant_finance.rates.hagan_west import monotone_convex
label_desc: Use image node_id 1 for calling a global function with example usage: _compute_pv(cashflows, cashflow_times, reference_rates, reference_times) and returns: tf