docstr: Tests the mean and vol of the batched univariate GBM sampled paths.
docstr_tok: ["Tests","the","mean","and","vol","of","the","batched","univariate","GBM","sampled","paths","."]
code: def test_univariate_sample_mean_var_constant_parameters_batched2(
      self, supply_draws, dtype
  ):
      """Tests the mean and vol of the batched univariate GBM sampled paths."""
      # Batch dimensions [2, 3, 4].
      mu = (3.0 * np.random.uniform(size=(2, 3, 4, 1))).astype(dtype)
      sigma = (2.0 * np.random.uniform(size=(2, 3, 4, 1))).astype(dtype)
      times = np.array(
          [1.4, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0], dtype=dtype
      )
      initial_state = np.ones_like(mu, dtype=dtype) * 100.0
      (
          mean,
          var,
          se_mean,
          se_var,
      ) = calculate_sample_paths_mean_and_variance(
          self,
          mu,
          sigma,
          times,
          initial_state,
          supply_draws,
          NUM_SAMPLES,
          dtype,
      )
      expected_mean = (mu - sigma**2 / 2) * times + np.log(
          initial_state
      )
      expected_var = sigma**2 * times
  
      with self.subTest("Drift"):
          arrays_all_close(
              self,
              tf.squeeze(mean),
              expected_mean,
              se_mean * NUM_STDERRS,
              msg="comparing means",
          )
      with self.subTest("Variance"):
          arrays_all_close(
              self,
              tf.squeeze(var),
              expected_var,
              se_var * NUM_STDERRS,
              msg="comparing variances",
          )
  
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 10 for calling the GeometricBrownianMotionTest obj's underlying member method code with example usage: obj.test_univariate_sample_mean_var_constant_parameters_batched2(supply_draws, dtype) without return types