code: def _apply_discount(values, discount_factors, exercise_index):
      """Returns discounted values at the exercise time.
  
      Args:
        values: A real `Tensor` of shape `[num_samples, batch_size]`. Tracks the
          optimal cashflow of each sample path for each payoff dimension at
          `exercise_index`.
        discount_factors: A `Tensor` of shape
          `[num_exercise_times + 1, num_samples, batch_size]`. The `dtype` should be
          the same as of `samples`.
        exercise_index: An integer scalar `Tensor` representing the index of the
          exercise time of interest. Should be less than `num_exercise_times`.
  
      Returns:
        A `[num_samples, batch_size]` `Tensor` whose entries represent the sum of
        those elements to the right of `exercise_index` in `cashflow`, discounted to
        the time indexed by `exercise_index`. When `exercise_index` is zero, the
        return represents the sum of the cashflow discounted to present value for
        each sample path.
      """
      return (
          discount_factors[exercise_index + 1]
          / discount_factors[exercise_index]
      ) * values
  
file_path: tf-quant-finance/tf_quant_finance/models/longstaff_schwartz/lsm.py
imports: from typing import Callable
  import tensorflow.compat.v2
  from tf_quant_finance import types
  from tf_quant_finance import utils
label_desc: Use image node_id 4 for calling a global function with example usage: _apply_discount(values, discount_factors, exercise_index) and returns: unknown