docstr: Tests univariate GBM constant drift and volatility functions.
docstr_tok: ["Tests","univariate","GBM","constant","drift","and","volatility","functions","."]
code: def test_univariate_constant_drift_and_volatility(self, dtype):
      """Tests univariate GBM constant drift and volatility functions."""
      drift_in = 0.05
      vol_in = 0.5
      process = tff.models.GeometricBrownianMotion(
          drift_in, vol_in, dtype=dtype
      )
      drift_fn = process.drift_fn()
      volatility_fn = process.volatility_fn()
      state = np.array([[1.0], [2.0], [3.0]], dtype=dtype)
      with self.subTest("Drift"):
          drift = drift_fn(0.2, state)
          expected_drift = state * drift_in
          self.assertAllClose(
              drift, expected_drift, atol=1e-8, rtol=1e-8
          )
      with self.subTest("Volatility"):
          vol = volatility_fn(0.2, state)
          expected_vol = state * vol_in
          self.assertAllClose(
              vol,
              np.expand_dims(expected_vol, axis=-1),
              atol=1e-8,
              rtol=1e-8,
          )
  
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 1 for calling the GeometricBrownianMotionTest obj's underlying member method code with example usage: obj.test_univariate_constant_drift_and_volatility(dtype) without return types