docstr: Tests that multivariate GBM sampling is XLA-compatible.
docstr_tok: ["Tests","that","multivariate","GBM","sampling","is","XLA-compatible","."]
code: def test_multivariate_xla_compatible(self):
      """Tests that multivariate GBM sampling is XLA-compatible."""
      corr_matrix = [[1, 0.1], [0.1, 1]]
      process = tff.models.MultivariateGeometricBrownianMotion(
          dim=2,
          means=0.05,
          volatilities=[0.1, 0.2],
          corr_matrix=corr_matrix,
          dtype=tf.float64,
      )
      times = [0.1, 0.5, 1.0]
      initial_state = [1.0, 2.0]
  
      @tf.function(jit_compile=True)
      def sample_fn():
          return process.sample_paths(
              times=times,
              initial_state=initial_state,
              num_samples=10000,
          )
  
      samples = sample_fn()
      log_s = tf.math.log(samples)
      mean = tf.reduce_mean(log_s, axis=0)
      expected_mean = (
          process._means - process._vols**2 / 2
      ) * np.array(np.expand_dims(times, -1)) + np.log(initial_state)
      self.assertAllClose(mean, expected_mean, atol=1e-2, rtol=1e-2)
  
imports: from absl.testing import parameterized
  import numpy
  import tensorflow.compat.v2
  import tf_quant_finance
  from tensorflow.python.framework import test_util
  from tf_quant_finance.models.geometric_brownian_motion import geometric_brownian_motion_test_utils
  from tf_quant_finance.models.geometric_brownian_motion import univariate_geometric_brownian_motion
label_desc: Use image node_id 20 for calling the GeometricBrownianMotionTest obj's underlying member method code with example usage: obj.test_multivariate_xla_compatible() and returns: process