code: def _backward_pde_coeffs(drift_fn, volatility_fn, discounting):
      """Returns coeffs of the backward PDE."""
  
      def second_order_coeff_fn(t, coord_grid):
          sigma = volatility_fn(t, _coord_grid_to_mesh_grid(coord_grid))
          sigma_times_sigma_t = tf.linalg.matmul(
              sigma, sigma, transpose_b=True
          )
  
          # We currently have [dim, dim] as innermost dimensions, but the returned
          # tensor must have [dim, dim] as outermost dimensions.
          rank = sigma.shape.rank
          perm = [rank - 2, rank - 1] + list(range(rank - 2))
          sigma_times_sigma_t = tf.transpose(sigma_times_sigma_t, perm)
          return sigma_times_sigma_t / 2
  
      def first_order_coeff_fn(t, coord_grid):
          mu = drift_fn(t, _coord_grid_to_mesh_grid(coord_grid))
  
          # We currently have [dim] as innermost dimension, but the returned
          # tensor must have [dim] as outermost dimension.
          rank = mu.shape.rank
          perm = [rank - 1] + list(range(rank - 1))
          mu = tf.transpose(mu, perm)
          return mu
  
      def zeroth_order_coeff_fn(t, coord_grid):
          if not discounting:
              return None
          return -discounting(t, _coord_grid_to_mesh_grid(coord_grid))
  
      return (
          second_order_coeff_fn,
          first_order_coeff_fn,
          zeroth_order_coeff_fn,
      )
  
file_path: tf-quant-finance/tf_quant_finance/models/geometric_brownian_motion/multivariate_geometric_brownian_motion.py
imports: import tensorflow.compat.v2
  from tf_quant_finance import utils
  from tf_quant_finance.math.pde import fd_solvers
  from tf_quant_finance.models import ito_process
  from tf_quant_finance.models import utils
label_desc: Use image node_id 1 for calling a global function with example usage: _backward_pde_coeffs(drift_fn, volatility_fn, discounting) and returns: second_order_coeff_fn,  first_order_coeff_fn,  zeroth_order_coeff_fn, unknown, mu, unknown, None