docstr: Helper function with details of testing heat equation solving.
docstr_tok: ["Helper","function","with","details","of","testing","heat","equation","solving","."]
code: def _testHeatEquation(
      self,
      grid,
      final_t,
      time_step,
      final_cond_fn,
      expected_result_fn,
      one_step_fn,
      lower_boundary_fn,
      upper_boundary_fn,
      error_tolerance=1e-3,
  ):
      """Helper function with details of testing heat equation solving."""
  
      # Define coefficients for a PDE V_{t} + V_{XX} = 0.
      def second_order_coeff_fn(t, x):
          del t, x
          return [[1]]
  
      xs = self.evaluate(grid)[0]
      final_values = tf.constant(
          [final_cond_fn(x) for x in xs], dtype=grid[0].dtype
      )
  
      result = fd_solvers.solve_backward(
          start_time=final_t,
          end_time=0,
          coord_grid=grid,
          values_grid=final_values,
          num_steps=None,
          start_step_count=0,
          time_step=time_step,
          one_step_fn=one_step_fn,
          boundary_conditions=[(lower_boundary_fn, upper_boundary_fn)],
          values_transform_fn=None,
          second_order_coeff_fn=second_order_coeff_fn,
          dtype=grid[0].dtype,
      )
  
      actual = self.evaluate(result[0])
      expected = self.evaluate(expected_result_fn(xs))
      self.assertLess(
          np.max(np.abs(actual - expected)), error_tolerance
      )
  
imports: import math
  from absl.testing import parameterized
  import numpy
  import tensorflow.compat.v2
  import tf_quant_finance
  from tensorflow.python.framework import test_util
label_desc: Use image node_id 9 for calling the ParabolicEquationStepperTest obj's underlying member method code with example usage: obj._testHeatEquation(grid, final_t, time_step, final_cond_fn, expected_result_fn, one_step_fn, lower_boundary_fn, upper_boundary_fn, error_tolerance) and returns: list