code: def _conditional_expected_variance_from_pde_solution(
      grid, value_grid, dtype
  ):
      """Computes E[variance|log_spot=k]."""
      # value_grid.shape = [1, num_x, num_y]
      log_spot_grid, variance_grid = tf.meshgrid(*grid)
      delta_s = variance_grid[1:, :] - variance_grid[:-1, :]
      # Calculate I(0)
      integral_0 = tf.math.reduce_sum(
          value_grid[0, :-1, :] * delta_s, axis=0
      )
      # Calculate I(1)
      integral_1 = tf.math.reduce_sum(
          variance_grid[:-1, :] * value_grid[0, :-1, :] * delta_s,
          axis=0,
      )
      variance_given_logspot = tf.math.divide_no_nan(
          integral_1, integral_0
      )
      return functools.partial(
          linear.interpolate,
          x_data=log_spot_grid[0, :],
          y_data=variance_given_logspot,
          dtype=dtype,
      )
  
imports: import functools
  import numpy
  import tensorflow.compat.v2
  from tf_quant_finance import datetime
  from tf_quant_finance import math
  from tf_quant_finance import utils
  from tf_quant_finance.experimental import local_volatility
  from tf_quant_finance.experimental.pricing_platform.framework.market_data import utils
  from tf_quant_finance.math import pde
  from tf_quant_finance.math.interpolation import linear
  from tf_quant_finance.models import generic_ito_process
label_desc: Use image node_id 5 for calling a global function with example usage: _conditional_expected_variance_from_pde_solution(grid, value_grid, dtype) and returns: functools