class_docstr: Tests for Brownian Bridge method.
code: def test_brownian_bridge_double(self, dtype):
      def brownian_bridge_numpy(
          x_start, x_end, upper_b, lower_b, variance, n_cutoff
      ):
          def f(k):
              a = np.exp(
                  -2
                  * k
                  * (upper_b - lower_b)
                  * (k * (upper_b - lower_b) + (x_end - x_start))
                  / variance
              )
              b = np.exp(
                  -2
                  * (k * (upper_b - lower_b) + x_start - upper_b)
                  * (k * (upper_b - lower_b) + (x_end - upper_b))
                  / variance
              )
              return a - b
  
          return np.sum(
              [f(k) for k in range(-n_cutoff, n_cutoff + 1)], axis=0
          )
  
      x_start = np.asarray(
          [[1.0, 1.1, 1.1], [1.05, 1.11, 1.11]], dtype=dtype
      )
      x_end = np.asarray(
          [[2.0, 2.1, 2.8], [2.05, 2.11, 2.11]], dtype=dtype
      )
      variance = np.asarray([1.0, 1.0, 1.1], dtype=dtype)
      n_cutoff = 3
  
      upper_barrier = 3.0
      lower_barrier = 0.5
  
      np_values = brownian_bridge_numpy(
          x_start,
          x_end,
          upper_barrier,
          lower_barrier,
          variance,
          n_cutoff=n_cutoff,
      )
  
      tff_values = self.evaluate(
          tff.black_scholes.brownian_bridge_double(
              x_start=x_start,
              x_end=x_end,
              variance=variance,
              dtype=dtype,
              upper_barrier=upper_barrier,
              lower_barrier=lower_barrier,
              n_cutoff=n_cutoff,
          )
      )
  
      self.assertEqual(tff_values.shape, np_values.shape)
      self.assertArrayNear(
          tff_values.flatten(), np_values.flatten(), 1e-7
      )
  
file_path: tf-quant-finance/tf_quant_finance/black_scholes/brownian_bridge_test.py
imports: 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 1 for calling the BrownianBridgeTest obj's underlying member method code with example usage: obj.test_brownian_bridge_double(dtype) and returns: np, unknown