code: def _volatility_fn_from_total_covar_fn(total_covariance_fn):
      """Volatility function from total covariance function."""
  
      def vol_fn(time):
          # We should consider changing the start time to be some small dt behind
          # the time. In case the total covariance is being computed by a numerical
          # integration, this will mean that we spend less time iterating.
          start_time = tf.zeros_like(time)
          total_covar_fn = lambda t: total_covariance_fn(start_time, t)
          vol_sq = gradient.fwd_gradient(total_covar_fn, time)
          return tf.linalg.cholesky(vol_sq, name="volatility")
  
      return vol_fn
  
file_path: tf-quant-finance/tf_quant_finance/models/legacy/brownian_motion_utils.py
imports: import tensorflow.compat.v2
  from tf_quant_finance.math import gradient
label_desc: Use image node_id 6 for calling a global function with example usage: _volatility_fn_from_total_covar_fn(total_covariance_fn) and returns: vol_fn, tf