docstr: Tests path properties for 2-dimentional Ito process.
  
  We construct the following Ito processes.
  
  dX_1 = mu_1 sqrt(t) dt + s11 dW_1 + s12 dW_2
  dX_2 = mu_2 sqrt(t) dt + s21 dW_1 + s22 dW_2
  
  mu_1, mu_2 are constants.
  s_ij = a_ij t + b_ij
  
  For this process expected value at time t is (x_0)_i + 2/3 * mu_i * t^1.5.
  
  Args:
    random_type: Random number type defined by tff.math.random.RandomType
      enum.
    seed: Random seed.
docstr_tok: ["Tests","path","properties","for","2-dimentional","Ito","process",".","We","construct","the","following","Ito","processes",".","dX_1","=","mu_1","sqrt","(","t",")","dt","+","s11","dW_1","+","s12","dW_2","dX_2","=","mu_2","sqrt","(","t",")","dt","+","s21","dW_1","+","s22","dW_2","mu_1",",","mu_2","are","constants",".","s_ij","=","a_ij","t","+","b_ij","For","this","process","expected","value","at","time","t","is","(","x_0",")","_i","+","2\/3","*","mu_i","*","t^1.5",".","Args",":","random_type",":","Random","number","type","defined","by","tff.math.random.RandomType","enum",".","seed",":","Random","seed","."]
code: def test_sample_paths_2d(self, random_type, seed):
      """Tests path properties for 2-dimentional Ito process.
  
      We construct the following Ito processes.
  
      dX_1 = mu_1 sqrt(t) dt + s11 dW_1 + s12 dW_2
      dX_2 = mu_2 sqrt(t) dt + s21 dW_1 + s22 dW_2
  
      mu_1, mu_2 are constants.
      s_ij = a_ij t + b_ij
  
      For this process expected value at time t is (x_0)_i + 2/3 * mu_i * t^1.5.
  
      Args:
        random_type: Random number type defined by tff.math.random.RandomType
          enum.
        seed: Random seed.
      """
      mu = np.array([0.2, 0.7])
      a = np.array([[0.4, 0.1], [0.3, 0.2]])
      b = np.array([[0.33, -0.03], [0.21, 0.5]])
  
      def drift_fn(t, x):
          return mu * tf.sqrt(t) * tf.ones_like(x, dtype=t.dtype)
  
      def vol_fn(t, x):
          del x
          return (a * t + b) * tf.ones([2, 2], dtype=t.dtype)
  
      num_samples = 10000
      times = np.array([0.1, 0.21, 0.32, 0.43, 0.55])
      x0 = np.array([0.1, -1.1])
      paths = self.evaluate(
          euler_sampling.sample(
              dim=2,
              drift_fn=drift_fn,
              volatility_fn=vol_fn,
              times=times,
              num_samples=num_samples,
              initial_state=x0,
              time_step=0.01,
              random_type=random_type,
              seed=seed,
          )
      )
  
      self.assertAllClose(paths.shape, (num_samples, 5, 2), atol=0)
      means = np.mean(paths, axis=0)
      times = np.reshape(times, [-1, 1])
      expected_means = x0 + (2.0 / 3.0) * mu * np.power(times, 1.5)
      self.assertAllClose(means, expected_means, rtol=1e-2, atol=1e-2)
  
file_path: tf-quant-finance/tf_quant_finance/models/euler_sampling_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 4 for calling the EulerSamplingTest obj's underlying member method code with example usage: obj.test_sample_paths_2d(random_type, seed) and returns: unknown, unknown